[SOLVED] Issues with uploading files

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
jgoforth
New Member
New Member
Posts: 3
Joined: Sun Aug 05, 2012 6:18 am

[SOLVED] Issues with uploading files

Post 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.
Last edited by jgoforth on Sun Aug 05, 2012 5:16 pm, edited 1 time in total.
jgoforth
New Member
New Member
Posts: 3
Joined: Sun Aug 05, 2012 6:18 am

Re: Issues with uploading files

Post 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'));
Post Reply

Return to “Developers Discussion”