pritaeas
Posting Expert
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
The str_replace() function takes 4 parameters: search, replace, subject, count
search = term to search for, in your case: " "
replace = term to replace search term with, in your case: "_"
subject = the string itself (filename): $file
count = no of instances - you can leave this out
$file = str_replace(" ","_",$file);
diafol
Rhod Gilbert Fan (ardav)
7,796 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
Try echoing out $replace before doing anything to see if it is empty or not.
$replace = $_FILES['uploaded_file']['name'];
echo "before: " . $replace . "";
$replace = str_replace(" ","_",$replace);
echo "after: " . $replace;
@pritaeas
Sorry mate, I seem to have hijacked a solution you were giving. That was rude.
diafol
Rhod Gilbert Fan (ardav)
7,796 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
What came out of the code I suggested (the echoing)?
diafol
Rhod Gilbert Fan (ardav)
7,796 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080