Best way to accept image files submitted by users?

Hi there,

I am running a competition/contest in which users need to submit a photo/drawing. I am wondering the best way to receive these entries. I was thinking of letting them just email their images to me, but I’m thinking it will soon clog up my email.

Can anyone suggest the best way I could set up an entry method to receive them?

Thanks!

Create an upload form which saves it to a directory on your server?

But be VERY careful to interrogate the file being uploaded to ensure it’s an actual image and not a script which can toast your server.

Do a search for secure image upload in … the server side scripting language of your choice and you should be able to find something that would meet your needs.

1 Like

Thanks for the suggestion.

Is there an easy way for the image to be uploaded with the file name changed to the users first/last name? I’m wondering how to store the details when they submit an entry

Play about with this example:

https://www.w3schools.com/php/php_file_upload.asp

If you know the users name, either by their log-in or from form fields, it should not be a problem to change the filename. Most upload scripts I have looked at contain renaming.

If you expect a lot, a database would be the obvious way. It could store image ID/filename, user ID, date/time, any other info you want.
You may want to name the file according to ID rather than user name to ensure uniquenes and aid retrieval.
Using the ID would require the insert before renaming to get the ID for the name.

1 Like