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: Advanced:
Uploading

 



scuffed
stranger

May 24, 2001, 1:50 PM

Post #1 of 5 (1727 views)
Uploading Can't Post

How do you use this to upload a file to your server i tried and it does nothing at all
open(FILE, ">$file");
while (my $files=read(FILE, my $buffer, 1024){
print FILE $buffer;
}
close(FILE);



Pro_4
User

May 24, 2001, 2:21 PM

Post #2 of 5 (1725 views)
Re: Uploading [In reply to] Can't Post

Well, This is what i use and i works

Code
open(FILE, ">$file"); 
while (read($file, $buffer, 1024){
print FILE $buffer;
}
close(FILE);

When you upload stuff you need to use the filename as the filehandle to get the info. ($file, $buffer, 1024) The $file is the filename and $buffer is all the info in the file. So you
print FILE $buffer;
to add the info to the new file. You might want to add
binmode(FILE);
to it if you are going to upload binary files (i think).
Hope that answers your questions and your script will work :)

People Engrossed by a Reliable Language


Cure
User

May 26, 2001, 10:38 PM

Post #3 of 5 (1712 views)
Re: Uploading [In reply to] Can't Post

use CGI.pm to handle your uploads

perldoc CGI



Cure



scuffed
stranger

May 29, 2001, 1:51 PM

Post #4 of 5 (1701 views)
Re: Uploading [In reply to] Can't Post

Well thank you both for that help. will cgi.pm handle uplaods for ASCII format and binary with out having to make a spefication for them?



scuffed
stranger

May 29, 2001, 5:55 PM

Post #5 of 5 (1696 views)
Re: Uploading [In reply to] Can't Post

how and where would i go about to read up on that CGIperl doc for CGI.pm?
so i would get a quick reference to how to make an uploader


 
 


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

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