P
pjsenthil
Hi
I have to upload a file on to a server.I have tried it.
In my form of an HTML page, if i have a input file type ( file browse
element) it is working properly.and i am able to upload.
But in my case.I have so many images .i will list in the the browser
with check box for each and image preview for each.The user will check
the multiple check boxs and will upload.
if i am trying out this. i am not able to upload the file on the
server.
the problem wat i am facing is,...
the below is partial code...
-------------------------------------------------------
if($type_ok){
if(!$overwrite){ # if $overwite = 0 or flase, rename file using the
checkex sub
$fileName = check_existence($destination,$fileName);
}
# create a new file on the server using the formatted ( new instance
) filename
$r[$cnt]=$file;
$cnt++;
if(open(NEW, ">$destination$S{S}$fileName")){
$VAR{err} .= $!;
if($isWIN){ binmode NEW; } else { chmod(0777,
"$destination$S{S}$fileName"); }
# start reading users HD 1 kb at a time.
%note if the data from file browse it is working well..
but in case of check box .then the below read function is not working..
i have checked that $file value...it is getting the path of the source
perfectly.
****the problem is it not going into the while loop %
while(read($file, $buffer, 1024))
{
print NEW $e;
}
# close the new file on the server and we're done
close NEW;
} else {
# return the server's error message if the new file could not be
created
return qq~Error: Could not open new file on server. $!~;
}
# check limit hasn't just been overshot
if(-s "$destination$S{S}$fileName" > $limit){ # -s is the file size
unlink("$destination$S{S}$fileName"); # delete it if it's over the
specified limit
return qq~File exceeded limitations : $fileName~;
}
} else {
return qq~Bad file type : $file_type~;
}
if(-s "$destination$S{S}$fileName"){
return qq~Success $fileName~; #success
} else {
unlink("$destination$S{S}$fileName");
return ; qq~Upload failed : No data in $fileName. No size on server's
copy of file.
Check the path entered. $VAR{err}~;
}
-------------------------------------------
i have written the comments with in the code above..as (%-------%).
So can one suggest me wat problem it can be,.
pl
I have to upload a file on to a server.I have tried it.
In my form of an HTML page, if i have a input file type ( file browse
element) it is working properly.and i am able to upload.
But in my case.I have so many images .i will list in the the browser
with check box for each and image preview for each.The user will check
the multiple check boxs and will upload.
if i am trying out this. i am not able to upload the file on the
server.
the problem wat i am facing is,...
the below is partial code...
-------------------------------------------------------
if($type_ok){
if(!$overwrite){ # if $overwite = 0 or flase, rename file using the
checkex sub
$fileName = check_existence($destination,$fileName);
}
# create a new file on the server using the formatted ( new instance
) filename
$r[$cnt]=$file;
$cnt++;
if(open(NEW, ">$destination$S{S}$fileName")){
$VAR{err} .= $!;
if($isWIN){ binmode NEW; } else { chmod(0777,
"$destination$S{S}$fileName"); }
# start reading users HD 1 kb at a time.
%note if the data from file browse it is working well..
but in case of check box .then the below read function is not working..
i have checked that $file value...it is getting the path of the source
perfectly.
****the problem is it not going into the while loop %
while(read($file, $buffer, 1024))
{
print NEW $e;
}
# close the new file on the server and we're done
close NEW;
} else {
# return the server's error message if the new file could not be
created
return qq~Error: Could not open new file on server. $!~;
}
# check limit hasn't just been overshot
if(-s "$destination$S{S}$fileName" > $limit){ # -s is the file size
unlink("$destination$S{S}$fileName"); # delete it if it's over the
specified limit
return qq~File exceeded limitations : $fileName~;
}
} else {
return qq~Bad file type : $file_type~;
}
if(-s "$destination$S{S}$fileName"){
return qq~Success $fileName~; #success
} else {
unlink("$destination$S{S}$fileName");
return ; qq~Upload failed : No data in $fileName. No size on server's
copy of file.
Check the path entered. $VAR{err}~;
}
-------------------------------------------
i have written the comments with in the code above..as (%-------%).
So can one suggest me wat problem it can be,.
pl