On Sat, November 5, 2005 2:11 am, kumar kumar wrote:
I am Software Engineer in hyderabad . if possible i
need some help in PHP.
we are developing one applet that will upload the
files/folders upto 2gb . the applet will send the file
in bytes stream via http . At server side the PHP has
to receive the file bytes stream and as to write the
file in server system . with the file path preserve .
My crystal ball says you are going to end up being disappointed...
Making the user sit there in front of a web page waiting for a 2 GIG
file to be uploaded is almost-for-sure doomed in the long run...
Set up FTP or something that is ready to handle 2 GIG files.
HTTP and PHP ain't it...
You'll probably have browsers timing out long before the 2 GIG gets
there, even if data is still being transferred. And that will just be
one of the un-solvable headaches you're asking for.
i tried this code to get some idea
$request = new
Java(javax.ServletRequest,$req);
$request - getInputStream();
$in = $new
Java(javax.servlet.ServletInputStream,$in);
$byte[] = new Java(java.lang.byte,$line);
$bytes = 0;
new Java(java.io.FileOutputStream, $fileOutS)
$fileOutS = new Java(
FileOutputStream($dir$file));
while(0 ($bytes = in -read($line))){
$fileOutS-write($line,0, $bytes);
}
its not working . and the requirment is also not to
use java extension . i have to develop it with out
java extension .
That said...
Try something like this:
?php
$path = /full/path/to/destination/filename;
$stdin = fopen('php://stdin', 'r') or die(Could not open stdin.);
$output = fopen($path, 'w') or die(Could not open $path for
writing. Check permissions. And don't put it in the web tree!);
$total = 0;
while (!feof($stdin)){
$data = fread($stdin, 2048);
$bytes = fwrite($output, $data);
$total += $bytes;
if ($bytes != strlen($data)){
die(Failed after writing $total bytes!);
}
}
//these are not really needed here, as PHP will close them as soon
//as this script ends.
//but your real script might have more stuff after these lines
fclose($stdin);
fclose($output);
?
How to tie that into your web-server is left as an exercise, but odds
are pretty good you can work that out much easier/faster than you can
solve the problem of a web browser being totally unsuitable for
uploading 2 GIG files in the first place.
--
Like Music?
http://l-i-e.com/artists.htm
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php