Jump to content

Image upload rename - removing spaces


CanMan2004

Recommended Posts

Hi all

 

I've written a script to upload a resize an image, but I cant figure out how I can get it to remove all spaces from the filename, the code is

 

if ($_FILES['image']['name'] != '')
{
$randy = random(12);
$uploadImageDir = '../image_upload/activity_uploads/'.$randy.'';
$uploadImage = $uploadImageDir . $_FILES['image']['name'];
$uploadImageFormat = $randy.$_FILES['image']['name'];
if (move_uploaded_file($_FILES['image']['tmp_name'], $uploadImage) )
{
}
$imageupload = $uploadImage;
createthumb($imageupload,$imageupload,767,'','',411);		
}
else
{
print"<script>alert ('There was a problem with your image');</script>";
print"<script>document.location='register.php'; </script>";
}

 

Where would I place a str_replace function?

 

Can anyone help?

 

Thanks

 

Dave

Link to comment
https://forums.phpfreaks.com/topic/38090-image-upload-rename-removing-spaces/
Share on other sites

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.