0

I have created a custom app that will allow logged in users to upload an image which will be automatically uploaded to my web server through SFTP method.

Is there a module or even programmatically possible to detect from my Drupal 8 site that there is new image uploaded to the directory ../sites/files/app-images/ of my server and retrieve the name of that image ?

New contributor
Ta La is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • I’d think you’d be better off looking at an entity save/create event instead. Are these File entities or Media? – Kevin Oct 7 at 23:51
  • @Kevin It is a simple image (.jpeg) just uploaded to my server using a mobile app ! It is not a file entity. – Ta La Oct 8 at 6:04
  • A possible solution is to create a custom module which runs with each cron that scans this folder and creates Media Images out of the uploaded images. Of course you'll need to check whether the uploaded image is already in the database to avoid duplicates. – Ismail Cherri Oct 8 at 10:23
  • @Ismail Cherri I thought about the cron method but isn't a performance issue to run the cron every 5 seconds to check for a new uploaded image ? Since I need to know about the uploaded image as soon as it will be uploaded to my server ! – Ta La Oct 8 at 12:33
  • 1
    In this case, the upload should be done through Drupal itself not through SFTP, or at least create an endpoint in Drupal which creates the Media entity after the upload is done – Ismail Cherri Oct 8 at 13:16

Your Answer

Ta La is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.