PERL file upload

Ken Elliott's picture

They have: 358 posts

Joined: Jun 1999

Hello again. I wrote a PERL script that will upload an image file. But once the file is uploaded it becomes "garbled". In other words the picture transfers but looks like a fuzzy television picture after upload. I was wondering whether this is my scripts fault or is it server side. My guess is that it is somehow only uploading in ASCII or something. Anyone seen this before?

Pimpin like a pimp with an electrofied pimpin machine!

They have: 850 posts

Joined: Jul 1999

It sounds like the script is uploading the files in ASCII rather than Binary. I have never written a file upload script, so I an not certain how this is done sorry.

------------------
Personal Site
http://www.wiredstart.com : The Technology Start Page

They have: 10 posts

Joined: May 2000

Hello,

I've written upload scripts for our products. It's important that after you've opend your file for output that you ensure that the data is in binmode in this manner:

code:

open(MYFILE,">$filename") or die;
binmode MYFILE;
print MYFILE $data;
close(MYFILE);[/code]

HTH.


------------------
Regards,
Jonathan Michaelson

Way to the Web Ltd
Web Hosting, E-Commerce and CGI Scripting
 http://www.waytotheweb.com 

Regards,
Jonathan Michaelson

Way to the Web Ltd
Commercial CGI Scripting
http://www.waytotheweb.com

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Perl has to be uploaded in ASCII, whereas images have to be uploaded in Binary.

fyi,

Suzanne

------------------
Zero Cattle
Suzanne
Tables DeMystified

Ken Elliott's picture

They have: 358 posts

Joined: Jun 1999

That was the answer that I was searching for..thanks alot. I am sure that was the problem.

VulKen

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.