Page 1 of 1

[SOLVED] Issues with uploading files

Posted: Sun Aug 05, 2012 6:27 am
by jgoforth
I am writing a module that involves uploading a file as part of a form. I created the input using CreateFileUploadInput. From looking at it the input is being created correctly. When I submit the form, I get nothing in the processing script. If I do a var_dump($_FILES) is shows an empty array.

I tried uploading a file using a custom field in the news module and that works fine, so it would seem it isn't a general configuration or permissions issue. I also tried the var_dump at the top of the news script and it showed what I would have expected.

I am at a complete loss as for why it seems to ignore the file upload field in the form. Any suggestions would be very welcome.

Re: Issues with uploading files

Posted: Sun Aug 05, 2012 5:16 pm
by jgoforth
After a good night's sleep, I figured out what I was missing. For any future people, or most likely myself the next time I try to do this, the issue was that I forgot to add an encode type to the form tag itself.

If you are doing file uploads the form creation needs to look something like this:

Code: Select all

$smarty->assign('startform', $this->CreateFormStart($id, 'event_edit', $returnid, 'post', 'multipart/form-data'));