Front-end custom Joomla module to upload an image and save it in the Joomla images folder

by wanderlusted   Last Updated September 03, 2019 21:10 PM

I work on a custom Joomla module that would let users to upload profile images. I created a JForm and wanted to use the form field type "file" as below:

<field name="Photo" type="file" label="Profile photo" size="10" accept="image/*" />
<field
    name="MAX_FILE_SIZE"
    value="5242880"
    type="hidden"
/> 

The form looks good and I can browse any images from my computer and submit the form. However when I dump the posted fields, I can see that my photo field has a simple string with the name of the image, not even the path of it.

What I'd like to do is to grab that image, check if it is safe, upload it and put it into a specified Joomla folder under the images folder.

This sounds like a common use case, but I was not able to find any description explaining the whole chain. So any hints, links, explanation, code samles would be higly appreciated.

Thanks a lot, w.



Related Questions


Updated November 02, 2016 09:04 AM

Updated March 23, 2016 08:04 AM

Updated July 30, 2016 08:04 AM

Updated February 27, 2016 01:04 AM

Updated October 08, 2018 09:10 AM