java - Upload something a running file in php -


i know sounds strange. i've php file on server responsible handling uploads. , java program on desktop sends files php file. want cancel file upload process server whenever want. want create kind of stream or stop ongoing upload process.

i tried use pids stop php file's running. php file doesn't start running before client finished uploading.

i want run "savepid()" function before upload started. can pid , stop running of file whenever want.

<?php include('func.php'); savepid(); //run before upload started  $in = stream_get_contents(fopen("php://input", "rb")); $out = fopen('pipeupload.txt', 'w');  while ( ! feof($in) ) {     fwrite($out, fread($in, 8192)); } ?> 

i know won't work. i'm looking solution stop ongoing upload process.

it might possible on server side.

example :

you have 20 images, every image more 2 mb in size. java file desktop send array of url's of images ready upload php file told. in php file have change, before every image upload have check in database (create table , add new field image_cancel or add field in prev table, set default value false) column name image_cancel true/false. if true stop execution , exit. create new script cancel_image.php ---> write code inside , set image_cancel field true.


Comments