Hello,
I use the swfupload v2.2.0.
I use the example /php/upload.php script. I have only configured the upload directory parameter.
When I upload the file the upload is correct and the file is saved on the server.
But when I upload a file with a extension which is not allowed, no error will return. Or a file is bigger than $max_file_size_in_bytes no error will indicated.
Files Queued: 0
Files Uploaded: 9
Errors: 0
What can I do to fix this problem?
Thanks
Best Regards
Udo
April 17, 2009 - 9:22am
To limit file size you have to indicate this is the SWFUpload settings. If there is an error on the server side you have to either return a status code indicating an error or let the server return a 200 and some text that you can handle in uploadSuccess' serverData parameter.
It's up to you.
By setting the right SWFUpload settings you can limit file types (by extension) and file size. These will trigger fileQueueError events before the file is ever uploaded. You can handle that event and display the proper warning to your users.
April 17, 2009 - 12:16pm
Hello gyphie,
thanks.
Do you have any example for me?
Best Regards Hillenbrand
April 17, 2009 - 12:58pm
The Application Demo does this.
If successful it returns "FILEID: xxxxxxx", otherwise it returns an error message.
The uploadSuccess function in handlers.js checks for the "FILEID" string and shows the image, if it's not there it shows the error message.
April 18, 2009 - 6:21am
When I have an echo command in the upload script, nothing is shown in the browser.
Why?
And how can I print somthing from the uploud.php?
Best Regards
Hillenbrand
April 20, 2009 - 11:01am
The output from upload.php is captured by the Flash Player (not the browser) and is passed to the JavaScript event handler for the upload_success event. See the documentation for uploadSuccess.
The second parameter contains the upload script's output. You'll have to program some JavaScript to act on the output.
May 15, 2009 - 10:26pm
I have installed SWFUpload using the simple demo as a start, and configured upload.php so that everything seems to be pointing in the right direction. I set $max_file_size_in_bytes = 2097152; so that files would be limited to under 2MB.
When I upload a "legal" file, it is uploaded and stored in the proper "images" directory. When I purposely upload an overly large file, the upload screen (I guess this is the SWF part) looks like everything is working. It shows the progress bar and ends the upload saying "1 file uploaded." But the file has not actually been stored (as it should not have, since the file was too big to be uploaded).
It seems to me that there is a problem with the error handling BEFORE things get sent to the server...file size is checked before actual upload, I think.
Does anyone know what I might have done to screw this up? I can post a link and/or more detail if that is helpful. I am not getting any errors, script nor browser nor javascript, so I assume the program is finding all of the required scripts correctly.
Thanks much!
May 18, 2009 - 9:29am
Please start your own thread for your own issue.
1) check your file_size_limit setting (SWFUpload settings). It should be set to "2 MB".
2) PHP will accept the file and return a 200 status code (which indicates to the client that everything is just fine). It does this even if there is an error. So you have to do your own proper error checking and return a proper error status. How is SWFUpload supposed to know there was a problem when the server told it everything was OK (status 200)?