magic8ball Posted January 18, 2007 Share Posted January 18, 2007 Because PHP works sequentially, I do not know if this is possible or not.I am trying to determine how to extract the tmp_file name for a file upload WHILE the file is being uploaded. My goal is to generate a popup window that will display the size of the php tmp_file so I can watch it grow as the file is uploading (this is what test.php does)For example:----------------------------------------------------------------------------form_upload excerpt code----------------------------------------------------------------------------...$MYFILE=( $_FILES[$fname]['tmp_name'])include("popup.php")...--------------------------------------------------------------------------------------------------------------------------------------------------------popup.php----------------------------------------------------------------------------<? $tmpfile= basename($_FILES[$fname]['tmp_name']); $file= basename($_FILES[$fname]['name']); echo "TEST<br><hr><br> <SCRIPT LANGUAGE='Javascript'> <!-- window.open('test.php?file=$file&tmpfile=$tmpfile','name','height=200,width=400,status=yes,toolbar=no,menubar=no,location=no'); //--> </SCRIPT> ";return('form_upload.php');?>------------------------------------------------------------------------------------test.php----------------------------------------------------------------------------<html><head><script type="text/javascript"><!-- Beginfunction reFresh() { location.reload(true)}window.setInterval("reFresh()",1800);// End --></script></head><? $file= $HTTP_GET_VARS['file']; $tmpfile= $HTTP_GET_VARS['tmpfile']; $filename = "/var/php/$tmpfile"; if (file_exists($filename)) { $fp = fopen("$filename", "r"); $temp_file=filesize($filename); fclose($fp); }; echo " Uploaded File = $file<BR> File Name = $filename<BR> "; if (file_exists($filename)) { echo " File Size = $temp_file<BR> "; }?>----------------------------------------------------------------------------I know MYFILE will gather the name of the tmp_name, however when I write upload code I can only get the tmp_name (MYFILE) to display AFTER the file is already uploaded.Doesn't PHP assign the php tmp_name and then begin uploading the file?Is there any way to launch a separate thread so I can initiate the "include" of the popup.php WHILE the file is being uploaded instead of waiting until it is completeThanks,-Magic <8> Ball Link to comment https://forums.phpfreaks.com/topic/34777-how-do-you-display-the-php-upload-tmp_file-name-while-the-file-is-being-uploaded/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.