Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

image uploading in windows

by olly (Scribe)
on May 11, 2001 at 12:22 UTC ( [id://79682]=perlquestion: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.

olly has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I am trying to upload pictures with the following code

my $filename = make_filename(); my $fh = $q->upload("picture_location"); binmode(fh); open (OUT, ">$filename.jpg") || die "Can't open: $!"; while (<$fh>) { print OUT; } close OUT;
But then when I try to open the file after it is uploaded it gives me the error can't open file. Does anyone know what I am doing wrong?

Imagination is more important then knowledge -Einstein-

Replies are listed 'Best First'.
(ar0n) Re: image uploading in windows
by ar0n (Priest) on May 11, 2001 at 12:27 UTC
    You're missing a dollar-sign in binmode(fh), but that isn't the cause of your problem, afaik (unless you mean with "can't open file" that you can't view it in an editor). Can you give us the exact error message?

    Update According to your reply, in all likelyhood binmode(fh) is the problem. Try replacing it with binmode($fh)

    ar0n ]

      The error message is can't open file and photoshop just doesn't open it.

      Imagination is more important then knowledge -Einstein-

Re: image uploading in windows
by bjelli (Pilgrim) on May 11, 2001 at 13:59 UTC

    I can't tell what the problem is, but here are two hints for debugging:

    1. Output the filename somewhere in your script, it would be good to know what make_filename() did.
    2. make sure the form your data is coming from has enctype set to "multipart/form-data".
    --
    Brigitte    'I never met a chocolate I didnt like'    Jellinek
    http://www.horus.com/~bjelli/         http://perlwelt.horus.at

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://79682]
Approved by root
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.