Jump to content

[SOLVED] Image upload... If it has a space, it errors!


TRemmie

Recommended Posts

Hi, I am using Flash and PHP and www.fpdf.org to allow users to upload images to my webserver, and then repoint it into the FPDF code and generate a PDF with the image. I figured that all out, however, if the user selectes an Image and it has a space (ie. desktop/folder/image 1.jpg) it errors. However, if they choose something like image_1.jpg, image-1.jpg, image1.jpg, it works it like a dream.

 

Here is my code:

 

$imagepath="www.webserver.com/files/";
$imagename=$_REQUEST['catcher']; 
$pdf->Image($imagepath . $imagename, 1.7551, 5.4792, 3.5, 2.33); 

 

Where $_REQUEST['catcher'];  is the name of the file they picked in flash, and is carried as a variable.

 

Now I was thinking is there a way to do like....

 

1.) A IF statement saying if there is a space, insert a _ , - or something? No idea how that would look. :(

2.)Possibly breaking it down again and doing:

 

$imagepath="www.webserver.com/files/";
$imagename=$_REQUEST['catcher']; 
$finalimage = $imagepath . $imagename;
$pdf->Image($finalimage, 1.7551, 5.4792, 3.5, 2.33); 

 

or something like that? Anyways... Any help would be super appreciated!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.