SWFUpload is a client-side file upload tool originally developed by Vinterwebb.se. It uses a combination of Flash and JavaScript to provide file upload functionality beyond what the basic browser provides with the <input type=”file” /> tag.

The main features that SWFUpload provides are:

  • The ability to select multiple files in the file browser dialog.
  • AJAX-style uploading without a page refresh.
  • Upload progress events.
  • Namespaced classes compatible with other JavaScript libraries (i.e., jQuery, Prototype, etc.).
  • Flash 9 and Flash 10 support. (Flash 8 support dropped in version 2.2.0)

SWFUpload is different from other Flash based upload tools because of the philosophy behind its design. SWFUpload gives developers control by leaving the UI in the browser (as much as possible). Developers can use XHTML, CSS, and JavaScript to tailor the upload UI to the needs and style of their site. Upload status updates are made through a set of simple JavaScript events. The developer uses these events to update the webpage as the file upload progresses.

How to use it

I am not going to explain how to use it, if any of you are interested on it, SWFUpload guys have developed a very good site explaining its full functionality.

The problem

After successfully installing the component on one of my projects and working amazingly good on the local computer, when I uploaded the project to the server where I contracted the hosting, suddenly I had an error: SWFUpload_0_0. Error HTTP Status: 403.

I google to find a solution to my problem and found tons of people having the same issue and the answers where always the same. For example:

“You are getting a 403. Which means “forbidden”. This is something on the web server that you’ll have to figure out.SWFUpload doesn’t save the file. It just uploads it to your upload_url (upload.php). You need to add PHP code that saves the file. In PHP the uploaded file is found in $_FILE["Filedata"] by default.”

Say what? I looked at my server’s configuration, checked folder permissions, reviewed my JS and PHP code… NOTHING. Then I thought it was something wrong with server POST Payload checks. Normally, this security configuration is disabled by default on Apache Servers but my provider ‘could’ possibly had this security check on. I had to try and…

Solution

I solved the issue by creating an .htaccess file and writing the following in it:

SetEnvIfNoCase Content-Type “^multipart/form-data;” “MODSEC_NOPOSTBUFFERING=Do not buffer file uploads”

Hope this also works for those having the same issue.

Happy New Year BTW!