-1

Is it possible to check if there's an active file upload via PHP?

I guess this would have to be done using JS if there was any way at all but I'm unsure of where to start. From Googling, I think ignore_user_abort() may be the function I need as that way I wouldn't have to worry about any checks, but it would be interesting to find out if JS can detect an active PHP upload

Ste
  • 591
  • 1
  • 9
  • 20
  • possible duplicate of [jquery ajax File Upload php](http://stackoverflow.com/questions/23980733/jquery-ajax-file-upload-php) – Davide Pastore Nov 03 '14 at 15:47
  • Are you trying to detect uploads to your website by anyone anywhere in the world, or just by the same user? In the same tab or a potentially different tab? – Boann Nov 03 '14 at 15:47
  • Just for clarification. You'd like to detect if somebody started uploading a file to your script and check progress of that upload? Or somehow the other way? – David162795 Nov 03 '14 at 15:47
  • Why do you need to know if there is an active file upload? Do you need this information in the PHP code or in the javascript? – Elian ten Holder Nov 03 '14 at 15:56

1 Answers1

1

PHP is a server side language so once the php code is executed there is either no new file uploaded or there is a new file uploaded, it's never executed during a file upload because the file upload is attached to the request to run the php.

Unless you handle the execution of the submit form by javascript there is no way to track the uploading of a file because the moment you press submit in a normal html field the javascript on the page stops executing because the browser is working on the new page that is being loaded.

Elian ten Holder
  • 262
  • 1
  • 3
  • 15