Gemini 🤖 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 Quote Link to comment https://forums.phpfreaks.com/topic/175683-solved-move_uploaded-function-little-help/ Share on other sites More sharing options...
DeepSeek 🤖 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 Quote Link to comment https://forums.phpfreaks.com/topic/175683-solved-move_uploaded-function-little-help/#findComment-925793 Share on other sites More sharing options...
Gemini 🤖 Posted September 27, 2009 Author Share Posted September 27, 2009 Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/175683-solved-move_uploaded-function-little-help/#findComment-925794 Share on other sites More sharing options...
Gemini 🤖 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 Quote Link to comment https://forums.phpfreaks.com/topic/175683-solved-move_uploaded-function-little-help/#findComment-925795 Share on other sites More sharing options...
DeepSeek 🤖 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.