File Upload Problem

someguy2k 17 Feb, 2011
I'm having a difficult time resolving a file-upload problem. I have a dynamic form working perfectly with the exception of my Fileupload field. When "enabled uploads" is set to No, I am able to save the filename to the database.

When I have "enabled uploads" set to Yes, files are renamed emailed and uploaded BUT the filename is not saved to the database.

This is what I'm using to dynamically load form fields...
<?php
...
//file upload section
echo "<div class='form_item'>
<div class='form_element cf_fileupload'>
<input class='cf_fileinput cf_inputbox' title='' size='10' id='$file' name='$file' type='file' />";

?>

Any suggestions?
someguy2k 17 Feb, 2011
Forgot to include my field name/allowed extension...
fileupload_1:jpg|png|pdf|xls{9999-1},
fileupload_2:jpg|png|pdf|xls{9999-1},fileupload_3:jpg|png|pdf|xls{9999-1},
fileupload_4:jpg|png|pdf|xls{9999-1},fileupload_5:jpg|png|pdf|xls{9999-1},
fileupload_6:jpg|png|pdf|xls{9999-1}
GreyHead 17 Feb, 2011
Hi someguy2k,

ChronoForms uses a stored table definition to write records to the database, Almost certainly this doesn't include fileupload_1, fileupload_2, etc.

What columns do you actually have in the database record to store all the filenames?

Bob
someguy2k 17 Feb, 2011
The columns names are fileupload_1, fileupload_2, fileupload_3 etc...

if I change the form field to a text box or set enable uploads to No it works. Meaning it saves to the DB (fileupload_1, etc..)

<input class='cf_textbox' title='' size='10' id='$file' name='$file' type='text' />
GreyHead 17 Feb, 2011
Hi someguy2k,

Please turn debug on in the form General Tab, then submit the form and post the debug results here.

Bob
someguy2k 18 Feb, 2011

Posted: Array ( [cf_id] => 10 [completedate_8] => 02/22/2011 [completedate_9] => [completedate_10] => [completedate_11] => [completedate_12] => [completedate_13] => [continue] => continue [c075127c23230a07d24e605fca6c3e58] => 1 [1cf1] => 0683c6304c93bd0dc5b18025bc6bd212 [chronoformname] => request_completion )
Files: Array ( )
Current step: 1

1. Form passed first SPAM check OK
2. Form passed the submissions limit (if enabled) OK
3. Form passed the Image verification (if enabled) OK
4. Form passed the server side validation (if enabled) OK
5. $_POST Array: Array ( [cf_id] => 10 [completedate_8] => 02/22/2011 [completedate_9] => [completedate_10] => [completedate_11] => [completedate_12] => [completedate_13] => [continue] => continue [c075127c23230a07d24e605fca6c3e58] => 1 [1cf1] => 0683c6304c93bd0dc5b18025bc6bd212 [chronoformname] => request_completion )
6. $_FILES Array: Array ( [fileupload_8] => Array ( [name] => mycal.JPG [type] => image/jpeg [tmp_name] => /tmp/phpmr4O0g [error] => 0 [size] => 187832 ) [fileupload_9] => Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ) [fileupload_10] => Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ) [fileupload_11] => Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ) [fileupload_12] => Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ) [fileupload_13] => Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ) [fileupload_14] => Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ) )
7. Upload routine started for file upload by : fileupload_1
8. Upload routine started for file upload by : fileupload_2
9. Upload routine started for file upload by : fileupload_3
10. Upload routine started for file upload by : fileupload_4
11. Upload routine started for file upload by : fileupload_5
12. Upload routine started for file upload by : fileupload_6
13. Upload routine started for file upload by : fileupload_7
14. Upload routine started for file upload by : fileupload_8
15. /home/nuemind/public_html/cheeburger/components/com_chronocontact/uploads/phase2/20110217155931_mycal.JPG has been uploaded OK
16. Upload routine started for file upload by : fileupload_9
17. Upload routine started for file upload by : fileupload_10
18. Upload routine started for file upload by : fileupload_11
19. Upload routine started for file upload by : fileupload_12
20. Upload routine started for file upload by : fileupload_13
21. Upload routine started for file upload by : fileupload_14
22. Upload routine started for file upload by : fileupload_15
23. Upload routine started for file upload by : fileupload_16
24. Form passed the plugins step (if enabled) OK
25. Debug End

Posted: Array ( [cf_id] => 10 [completedate_8] => 02/22/2011 [completedate_9] => [completedate_10] => [completedate_11] => [completedate_12] => [completedate_13] => [continue] => continue [c075127c23230a07d24e605fca6c3e58] => 1 [1cf1] => 0683c6304c93bd0dc5b18025bc6bd212 [chronoformname] => request_completion [completionstatus_8] => pending [update] => update [cfformstep] => 1 )
Files: Array ( [fileupload_8] => /home/nuemind/public_html/cheeburger/components/com_chronocontact/uploads/phase2/20110217155931_mycal.JPG )

GreyHead 18 Feb, 2011
Hi someguy2k,

Thanks for the admin login. You didn't mention that you weren't using ChronoForms to handle the file uploads :-(

Not problem but it just means that you need to add the PHP to add the file names into the $_POST array before the DB Connection runs.

Bob
redrings 25 Feb, 2011
I hope I'm not hijacking this post, but I'm having a very similar problem; however, I AM using chronoforms to handle the file uploads.

Also, it seems that sometimes it is storing the image file locations in the database, and sometimes it is not (well, make that most of the time it is not). I've tested the form many times from my machine and it works for me every time, but since we've made the form active and started accepting registrations the problem has shown up. The files upload successfully regardless of whether or not the filename gets store in the database, so that is good, but I am having to go into the database and add the missing filenames (by attempting to match the timestamp to the entry) so that the chronoconnectivity page works right.

Here is a link to the form: http://entrepreneurship.okstate.edu/creativity/contests/current/enter
and the connectivity page: http://entrepreneurship.okstate.edu/creativity/contests/current/entries

Any ideas on how I can make sure the filenames are getting stored in the db?

Thanks!
GreyHead 25 Feb, 2011
Hi redrings,

Nothing very useful to suggest here. ChronoForms is pretty reliable in saving stuff. I can only guess that with 10 uploads on the same page somethign is timing out before the uploads are all complete.

Bob
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger