Jump to content

Problem with white spaces on image file upload?


simmsy

Recommended Posts

Hi im having trouble with uploading images with spaces in as they dont show up in the browser.

Here is the code:

$image = addslashes($_FILES['image']['name']);

$target = "images/"; 
$target = $target . basename( $_FILES['image']['name']); 

  //Writes the photo to the server 
if(move_uploaded_file($_FILES['image']['tmp_name'], $target)) 
{ 

 

Any help would be appreciated.

Perhaps you don't understand what we're asking.  The code you're showing us is used to move the uploaded file to a permanent storage location.  You need to show us code that includes an <img> tag, that's the code that displays the image.

Ah I get you now! Well I select it from the mysql table its been saved to and is:

"<div id='profileimage'><img src=".$image." width='200px' height='200px'></div> "

 

but after looking at the source code the hyperlink is stopping at the white space in the title "<img src=http://www.fightwatcher.com/images/Blue "stops here! then no hyperlink after here!"hills.jpg width='200px' height='200px'></div>

 

 

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.