Gayner Posted September 27, 2009 Share Posted September 27, 2009 move_uploaded_file($_FILES["file"]["tmp_name"], "packs/cimage/" . $_FILES["file"]["name"]); I need to make it so, if somone has spaces when they upload like "copy of image.png" I need this function (move_uploaded_file or whatever to take out all the spaces and scrunch it together so it will be "copyofimage.png' or something but i can't have spaces .. thanks Link to comment https://forums.phpfreaks.com/topic/175683-solved-move_uploaded-function-little-help/ Share on other sites More sharing options...
yettti Posted September 27, 2009 Share Posted September 27, 2009 what you would need to do is change the name of the moved file move_uploaded_file($_FILES["file"]["tmp_name"], "packs/cimage/" . str_replace (" ", "",$_FILES["file"]["name"]$abcd)); what we are doing is removing the spaces from the output file name... str_replace (" ", "",$_FILES["file"]["name"]$abcd) this replaces all the space characters with nothing, thus removing the spaces Link to comment https://forums.phpfreaks.com/topic/175683-solved-move_uploaded-function-little-help/#findComment-925793 Share on other sites More sharing options...
Gayner Posted September 27, 2009 Author Share Posted September 27, 2009 what you would need to do is change the name of the moved file move_uploaded_file($_FILES["file"]["tmp_name"], "packs/cimage/" . str_replace (" ", "",$_FILES["file"]["name"]$abcd)); what we are doing is removing the spaces from the output file name... str_replace (" ", "",$_FILES["file"]["name"]$abcd) this replaces all the space characters with nothing, thus removing the spaces Sweet thanks but what is $abcd? i get some yntax error, unexpected ',' error can u check code againty Link to comment https://forums.phpfreaks.com/topic/175683-solved-move_uploaded-function-little-help/#findComment-925794 Share on other sites More sharing options...
Gayner Posted September 27, 2009 Author Share Posted September 27, 2009 now i get cimage/Copy%20of%20ez%20h.png and image doesn't show.. omg Link to comment https://forums.phpfreaks.com/topic/175683-solved-move_uploaded-function-little-help/#findComment-925795 Share on other sites More sharing options...
yettti Posted September 27, 2009 Share Posted September 27, 2009 oops... my mistake syntax error move_uploaded_file($_FILES["file"]["tmp_name"], "packs/cimage/" . str_replace (" ", "",$_FILES["file"]["name"])); no idea where the $abcd came from Link to comment https://forums.phpfreaks.com/topic/175683-solved-move_uploaded-function-little-help/#findComment-925952 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.