Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
iAppsMail - File Upload
#1
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!)
#2
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
pi
#3
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.
#4
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.


Code:
Copy      Help
str filename="tempfile.zip"
str return post.format("filename=%s" filename)

IntPost "http://localhost/filesize.php" post return
out return


filesize.php
Code:
Copy      Help
<?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));

?>
pi
#5
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 ??
#6
the method i was thinking about doen't work Sad
on shared hosts you can't access the temp dir.
i will try something else (perl script).
just gimme a little bit more time.
pi
#7
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.
#8
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.
pi
#9
iAppsMail - Memory Usage Problem


Forum Jump:


Users browsing this thread: 1 Guest(s)