|
Posted by kumar kumar on 10/19/84 11:32
Hi
i am new to PHP .I am facing some problems .
Here is the code below
Here the applet will send the files thru http . files
from 30 bytes to 2 GB.
<?php
$logfile = "C:/temp/log1.txt";
$log = fopen($logfile,"a+");
fwrite($log, "Executing PHP Script \r\n");
$save_path = $_REQUEST['DATADIR'];
$filepath = $_REQUEST['FILEPATH'];
$filename = $_REQUEST['FILENAME'];
$fname = "$save_path$filepath$filename";
$tdir =$save_path.$filepath;
mkMDir($tdir);
function mkMDir($dir,$dirmode=0777)
{
if (!empty($dir)) {
if (!file_exists($dir)) {
preg_match_all('/([^\/]*)\/?/i', $dir,$tmp);
$default="";
foreach ($tmp[0] as $key=>$val) {
$default=$default.$val;
if(!file_exists($default))
if (!mkdir($default,$dirmode)) {
return -1;
}
}
}else if (!is_dir($dir)){
return -2;
}
}
return 0;
}
$fp = fopen($fname,"w");
$getdata = fopen("php://input", "r");
fwrite($log, "$fname Uploaded Successfully \r\n");
while (strlen($data = fread($getdata,8192)) > 0) {
fwrite($fp,$data);
}
fclose($fp);
fclose($getdata);
fclose($log);
?>
I tried this one its working for bigger files , but
its not working for small files less than 7 MB i am
unable to track the error or reason.and some times its
writing the less amount of bytes(60MB) then the
original one(90MB).
If possible please go thru this code and suggest me
the changes.
Thanking you
With Regards
Kumar
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
Navigation:
[Reply to this message]
|