Posts: 23
Threads: 7
Joined: Mar 2006
I am uploading file (after encoding them in base64) using IntPost and .php script at the server side. Problem - How do I determine how much data has already been posted during the IntPost call ??
(Trying to make a upload progress bar similar to the download one!)
Posts: 1,271
Threads: 399
Joined: Mar 2003
you could call a php script which checks the filesize of the uploadfile.
PHP: filesize - Manual
http://de.php.net/manual/en/function.filesize.php
Posts: 12,099
Threads: 142
Joined: Dec 2002
Quote:you could call a php script which checks the filesize of the uploadfile
How to show it in user side?
IntPost uses HttpSendRequest to send all data. It would be possible to show upload progress only if using HttpSendRequestEx instead.
You can show dialog with static text like "Uploading <filename>, <filesize>". The user then should approximately know the upload time.
Posts: 1,271
Threads: 399
Joined: Mar 2003
my idea is to call frequently the filesize php script.
you need to know the temp name and path of the upload file on the server.
str filename="tempfile.zip"
str return post.format("filename=%s" filename)
IntPost "http://localhost/filesize.php" post return
out return
filesize.php
<?php
$file=$_POST['filename'];
function size_hum_read($size){
/*
Returns a human readable size
*/
$i=0;
$iec = array("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB");
while (($size/1024)>1) {
$size=$size/1024;
$i++;
}
return substr($size,0,strpos($size,'.')+4).$iec[$i];
}
echo size_hum_read(filesize($file));
?>
Posts: 23
Threads: 7
Joined: Mar 2006
For the PHP Script:
1 Question: How do I know the temp name with which PHP is saving the current file since the upload script will not return until the upload is completed ??
Posts: 1,271
Threads: 399
Joined: Mar 2003
the method i was thinking about doen't work

on shared hosts you can't access the temp dir.
i will try something else (perl script).
just gimme a little bit more time.
Posts: 23
Threads: 7
Joined: Mar 2006
sure thing.
Oh and yes I already tried incorporating the already existing "progress bar" initiatives that are floating on the web. Did nt like them too much.
Posts: 1,271
Threads: 399
Joined: Mar 2003
i think the best way would be to use the IntPerformance function
to get the upload speed and that somehow to compare to the local
filesize.
still now i have no clue how to use IntPerformance and how to choose
the network card which should be watched.
i uses samurize for that and unfortunally there its a dll ...
but that should be the right approach, would be better than using server side scripts.
Posts: 12,099
Threads: 142
Joined: Dec 2002