Multiple File Upload plugin for jQuery - v1.23 use
|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Multiple File Upload plugin for jQuery - v1.23 use
by Darkhucx
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message this is the my first time to use the "Multiple File Upload plugin for jQuery - v1.23",
i use the example on the website to Upload the documents at the same time, but i have a question,for example,i set the attribute of "Input" to <form action="./xxx/up.php"> <input type="file" class="multi" accept="gif|jpg"/> </form> uplode four pics,but in the php document,check the function of dump($_FILES),the result is Array ( [picmanview4] => Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ) [picmanview3] => Array ( [name] => ddgk002.gif [type] => image/gif [tmp_name] => D:\Project\xxx\var\tmp\php2B1.tmp [error] => 0 [size] => 20690 ) [picmanview2] => Array ( [name] => DSC_8861.jpg [type] => image/pjpeg [tmp_name] => D:\Project\xxx\var\tmp\php2B2.tmp [error] => 0 [size] => 29280 ) [picmanview1] => Array ( [name] => DSC_1591.jpg [type] => image/pjpeg [tmp_name] => D:\Project\xxx\var\tmp\php2B3.tmp [error] => 0 [size] => 33908 ) [picmanview] => Array ( [name] => DSC_3632.jpg [type] => image/pjpeg [tmp_name] => D:\Project\xxx\var\tmp\php2B4.tmp [error] => 0 [size] => 36267 ) ) the Array always include a Failure array of [error] => 4,if you know the reason,please tell me,thanks so much |
|
|
Re: Multiple File Upload plugin for jQuery - v1.23 use
by Diego A.
::
Rate this Message:
Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message That is because of the extra file input the plugin creates.
It starts like this: <input type="file" name="file1"/> <!-- USER SEES AN EMPTY FILE SELECTOR When you select a file, the plugin does this: <input type="file" name="file2"/> <!-- USER SEES AN EMPTY FILE SELECTOR <input type="file" name="file1" value="C:\my\selected\files\file1.txt"/> <-- SELECTED FILE HIDDEN When you select another file, the plugin does this: <input type="file" name="file3"/> <!-- USER SEES AN EMPTY FILE SELECTOR <input type="file" name="file2" value="C:\my\selected\files\file2.txt"/> <-- SELECTED FILE HIDDEN <input type="file" name="file1" value="C:\my\selected\files\file1.txt"/> <-- SELECTED FILE HIDDEN And so on... The only way to get rid of the 'extra' file input is to intercept your form validation and disable it before the form is submitted. I've done this myself like this: // Append data to query string to form action in file uploads $('input:file', $('#MyForm')).each(function(){ var $this = $(this); if($this.fieldValue()=='') $this.disable(); }); And if you're submitting via ajax (with the form plugin), you can do this to re-enabled the file input: $('input:file', $('#MyForm')).enable(); I hope this helps...
|
| Free Forum Powered by Nabble | Forum Help |