Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Upload image problem

Status
Not open for further replies.

dragons2266

Technical User
May 22, 2007
5
GB
Hi. I recently changed hosts and now my script (for resumes) only partly works. It will upload the typed info but not the images.

Am quietly going insane. Can anyone help?

Have tried every CHMOD under the sun and have fiddled with path ways but to no avail. I am sure it’s simple because it worked on the last server with no problems and I didn't change anything when we moved apart from pathways. Can anyone take pity on me? Thanks so much


I think the problem might lie in the bit below somewhere but I am guessing:

___________________________

#upload picture
if ($image ne ""){
$image =~ m/^.*(\\|\/)(.*)/;
$temp = $2;
$temp =~ tr/[A-Z]/[a-z]/;
$temp =~ s/%20//gi;

open(LOCAL,">/var/
while (<$image>) {
print LOCAL $_;
}

$photo = "<center><img border=0 src=\"$imageUrl/cv/$username/$temp\"></center>";
$pictureurl = "$imageUrl/cv/$username/$temp";
}
else{
if ($pictureurl ne ""){
$photo = "<center><img border=0 src=\"$pictureurl\"></center>";
}
else{
$photo = "No Picture is Available";
}
}
 
Have you tried adding any error catching to your statements?

I also see that once you've received the image, you don't close the file handle, nor are you setting the file to read in BINMODE.

Code:
#upload picture
if ($image ne ""){
    $image =~ m/^.*(\\|\/)(.*)/;
    $temp = $2;
    $temp =~ tr/[A-Z]/[a-z]/;
    $temp =~ s/%20//gi;

    open(LOCAL,">/var/[URL unfurl="true"]www/html/cv/$username/$temp")[/URL] [COLOR=red]or die("Cannot open file: $!")[/color];

[COLOR=red]binmode LOCAL;[/color]

    while (<$image>) {
        print LOCAL $_;
    }

[COLOR=red]close LOCAL or die("Cannot close file: $!");

    $photo = "<center><img border=0 src=\"$imageUrl/cv/$username/$temp\"></center>";
    $pictureurl = "$imageUrl/cv/$username/$temp";
}
else{
    if ($pictureurl ne ""){
        $photo = "<center><img border=0 src=\"$pictureurl\"></center>";
    }
    else{
        $photo = "No Picture is Available";
    }
}

- George
 
thread cross posted in the perl forum.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top