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:
learning how to upload, need guidance

 



parham_m_s
journeyman

Feb 5, 2001, 7:11 PM

Post #1 of 4 (1178 views)
learning how to upload, need guidance Can't Post

i've taken on the challenge of trying to build my own multiple upload script without the use of modules (not as hard as some people think). I just have a couple of questions.

I went through several attempts, and noticed that each file is separated with 29 dashes, and 11 random characters. Ok, so i grab the first line before any line breaks, and split by that value. The problem is that the last line has an extra 2 dashes at the end, and it wont split. Is that common with all servers? Would it be more wise to split .. for example:

@files = split(/-----------------------------abcdefghijk(--)?/, $buffer);

Is there an easier solution? I'm thinking of just using the pop function to remove the last line with the 2 extra dashes, or try to remove it from the buffer altogether.

Secondly, when i do upload any files, they lose all formatting. I grab the main part of each file, print it to a new file on the server, but when i go to check the file, all formatting disappears, what goes wrong? At first i thought that it was because i was uploading from windows to unix, and all \r characters get lost, but are they actually stripped out when they're on a unix machine?

Finally, when i currently upload, i do check for improper characters in a filename ( all characters that windows currently doesn't allow in a filename )... is it necessary? I mean windows and other operating systems (i think) already restrict some characters on filenames, should i take that further?

sorry ahead of time if the words i used were used in the wrong context, i wasn't too clear on what to call my variables, so i just followed others ^_^.



zanardi
journeyman

Feb 13, 2001, 4:51 PM

Post #2 of 4 (1157 views)
Re: learning how to upload, need guidance [In reply to] Can't Post

can I see the code you are using right now to upload your files?

----------------------
Fueled By ZCom


Jasmine
Administrator / Moderator

Feb 14, 2001, 1:15 AM

Post #3 of 4 (1153 views)
Re: learning how to upload, need guidance [In reply to] Can't Post

Ummm... well, would it be too tongue in cheek to note that uploading is less painful with CGI.pm than what you're trying to do? Not to mention, faster, more efficient, and probably significantly less buggy than trying to start it from scratch.

CGI.pm has stood the test of time and is still the de facto standard for cgi programming. My recommendation: use it and focus your energies on code that hasn't already been written.



parham_m_s
journeyman

Feb 14, 2001, 9:23 AM

Post #4 of 4 (1147 views)
Re: learning how to upload, need guidance [In reply to] Can't Post

my curiosity got the better of me, and i tried to make an upload script. Your best bet would be to go with CGI.pm as Jasmine said. It's easy to use, and has a lot of uses. I'm just the kinda person that gets curious very easily, and i want to try to do everything ^_^.


 
 


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

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