File/upload_example.php

Description

upload_example.php

(C) 2007 SPLINELAB http://www.splinelab.com/flexupload/

Simple upload-script to demonstrate and test FlexUpload. Feel free to use this to start developing your own scripts.

Your upload script have to return some information for FlexUpload.

If the upload was successfull just print "OK" (uppercase without quotation marks) If something went wrong print a nice error message to inform the user what happened.

Important Note:

In real-life your upload script have to be more secure than this one. You have to make sure that only authorized users can upload files to your server! You also should check the extension of the uploaded file to prevent bad guys to upload malicious executable files (you should not accept files endig with .ph*, .cgi, .pl, ...)

Notes for migration from JavaUpload:

The field name has changed to "Filedata" (this is the default in Flex) so you have to use $_FILES['Filedata'] to access the uploaded file.

The format of the return value also has changed. If you print something different than "OK" FlexUpload assumes an error. E.g. In JavaUpload you printed "success=1\r\n" if your upload succeeds and "success=0\r\nSome error occurred" Now you print "OK" if your upload succeeds and "Some error occured". This helps to avoid parsing errors of the return value if your script raises some php warnings or errors.

Documentation generated on Sun, 17 Jun 2007 11:38:02 +0200 by phpDocumentor 1.3.0RC3