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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Uploading (file modes)



May 29, 2001, 1:49 PM

Post #1 of 4 (960 views)
Uploading (file modes) Can't Post

ok i dont get the bunmode() stuff and how do i upload in ASCII mode? i know binmode is for binary (i think)
if anyoen can help me out please do.
i have
open(FILE, $filename)
and so fourth
if you could give me a very precise example thank you

Enthusiast / Moderator

May 29, 2001, 2:21 PM

Post #2 of 4 (957 views)
Re: Uploading (file modes) [In reply to] Can't Post


what exactly are you trying to do? If you want a precise answer, you've got to ask a precise question...
Do you want to open a file in binary mode (that's what the code looks like) or do you want to use perl to handle FTP up-/downloads? If the last one is the case, use the Net::FTP package available on CPAN.

-- Marcus


May 29, 2001, 5:53 PM

Post #3 of 4 (956 views)
Re: Uploading (file modes) [In reply to] Can't Post

ok well i made a small file manager thingy and i tried to make a stupid upload for it and when i went to upload a .CGI file it wouldn't run on the server until i used flash fxp to upload it in the mode it needed ot be uploaded in

Enthusiast / Moderator

May 29, 2001, 11:39 PM

Post #4 of 4 (952 views)
Re: Uploading (file modes) [In reply to] Can't Post

That's not what I would call a precise question (if any), but let's give it another try. You've written a file manager in Perl. You can use the file manager for uploads. If you upload a CGI script, it won't run. The file manager is actually also a CGI script running on your server and you use a browser to select a file and upload it. (Let's see what else comes to my mind... hey, let me guess what you got for lunch...)
If the above should be correct, and you are running Windows, but your server is running some flavor of Unix, the problem is obviously the CR/LF sequence at the end of each line in the CGI script. You can handle this e.g. by using a search and replace pattern on the whole file before saving it:

$file =~ s/\r\n/\n/g;

Obviously, you should make this optional in your file manager, because only text files need this conversion.

-- Marcus


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

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