CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
uploading files

 



adolfo
Novice

Sep 18, 2001, 12:22 PM

Post #1 of 4 (929 views)
uploading files Can't Post

Hi people, I made a script to upload files via http
these are some lines of the script

(open INFO,">$info_upload_dir/$info_outfile");
while ($bytes = read($filename,$data,1024)) {
$length_info += $bytes;
print INFO $data;
}
close(INFO);

My problem is that the file that I had uploaded with this script has 0 bytes.
I don't know why the file's size = 0.
Please help me... =(
I had chmod the directory to 777 but the problem persists.
Thanx for your help!
c u

~Adolfo~


wickedxter
User

Sep 18, 2001, 1:59 PM

Post #2 of 4 (925 views)
Re: uploading files [In reply to] Can't Post

try addeding: binmode(<FILENAME>); (it might be with out the <> not to sure).



adolfo
Novice

Sep 19, 2001, 6:10 AM

Post #3 of 4 (920 views)
Re: uploading files [In reply to] Can't Post

thanx for ur help but I read this from the perldoc:
In other words: Regardless of platform, use
binmode() on binary files, and do not use
binmode() on text files.
I'm whant to upload text files =(
Does somebody has another idea?

~Adolfo~


Jean
User


Sep 19, 2001, 11:01 PM

Post #4 of 4 (912 views)
Re: uploading files [In reply to] Can't Post

In case you're talking about text files, why don't you use the regular

Code
while ($data = <INFO>) { 
print FILE $data;
}

If you still want the number of bytes read,
you can use the length() function and add the CRLF bytes for each line...

Hope this helps.

Jean Spector
QA Engineer @ mSAFE Ltd.
jean.spector@softhome.net

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives