Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Uploadify work?

I'm trying to figure out how Uploadify works.

I'm trying to see the POST in FireBug on the demos page, but can't see anything.

I thought even requests that originate from Flash still appear in Firebug.

LiveHTTPHeaders didn't tell me anything either.

When I try it on my site, the file can be selected OK and the progress bar moves, but I can't see any activity.

So, how do I check to make sure there is activity coming from the plugin?

Thanks

Update

OK, if I can't see the requests, what is the best way to make sure it is working? Make logs from the uploadify.php file?

like image 549
alex Avatar asked Oct 26 '10 03:10

alex


2 Answers

I believe that it uses an invisible flash file and interfaces with the flash through a Javascript interface. And since flash doesn't go through Firefox, firebug can't see it.

For logging that the requests are working (assuming you are looking for a way to log that it is happening when programming, and not after you have gotten it working), I would use FirePHP. FirePHP allows you to log information to Firebug. If you are just trying to keep a log of uploaded files, I would just write out to a file whenever you receive an upload.

like image 177
Thomas Avatar answered Nov 15 '22 01:11

Thomas


At the beginning of a file that is processing the actual uploads, add few lines, something like this:

$requestDataToLog = print_r($_POST, true)."\n\n";
$fp = fopen('log.txt', 'a');
fwrite($fp, requestDataToLog);
fclose($fp);

And check that you have correct values in POST by looking at the log file.

It would also be a good idea to secure the upload script a little so hackers cannot upload stuff to your website by just calling the PHP script with POST request.

Add a hash to the form (in a hidden field) and save it to a session once the form has been submitted (via AJAX I assume). On the top of the upload script check that the hash in session is correct and continue upload only then.

You might also want to make sure that the request is comming only from your website by checking $_SERVER['HTTP_REFERER'].

like image 27
Richard Knop Avatar answered Nov 15 '22 02:11

Richard Knop