garethhall Posted June 25, 2008 Share Posted June 25, 2008 Hey guys, Can anyone point me in the right direction please. I have this code below that clearly load a file into a blob, I would like to add a progress bar to this code. Can anyone here help me out or point me to the right place? Thanks in advance. <?php if($submitFrm == "true"){ echo "working"; $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; $fp = fopen($tmpName, 'r'); $content = fread($fp, filesize($tmpName)); $content = addslashes($content); fclose($fp); $newCvName = $fullName." 1"; if(!get_magic_quotes_gpc()){ $newCvName = addslashes($newCvName); }; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); mysql_select_db($dbname); $query = "INSERT INTO resumes (fileName, fileSize, fileType, content, applicantName, dateUploaded ) ". "VALUES ('$newCvName', '$fileSize', '$fileType', '$content', '$fullName', now() )"; mysql_query($query) or die('Error, query failed'); mysql_close($conn); }else{ echo "error"; }; ?> Link to comment https://forums.phpfreaks.com/topic/111820-how-to-make-a-simple-progress-bar/ Share on other sites More sharing options...
Wolphie Posted June 25, 2008 Share Posted June 25, 2008 I assume that this is an upload script. For a progress bar (which tracks the progress e.g. 10%, 20% etc..) you will need to use JavaScript; however, you cannot use PHP and JavaScript alone to track the progress, you will need to use some other language such as perl or python or java because JavaScript cannot access the file system to see how much of the file is uploaded and with PHP the file has to be completely uploaded in order for it to determine the filesize. Alternatively you could use flash. Link to comment https://forums.phpfreaks.com/topic/111820-how-to-make-a-simple-progress-bar/#findComment-574008 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.