maxat Posted June 22, 2007 Share Posted June 22, 2007 Hi I need help in my upload form, I don't know how to remove white space between two words if file name consist of two words. What should I put in the script below to remove the space? if (isset($_POST['btnAdd'])) { $uploaddir = 'certificates/'; $uploadfile = $uploaddir . $_FILES['file']['name']; if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) { $temp = explode('/', $_FILES['file']['name']); $certificate = 'certificates/' . urlencode(end($temp)); } else { $certificate = ''; } Link to comment https://forums.phpfreaks.com/topic/56680-upload-file-without-white-space-in-the-name/ Share on other sites More sharing options...
corbin Posted June 22, 2007 Share Posted June 22, 2007 You could just use str_replace to replace all spaces.... Just something like: $name = str_replace(" ", "", $name); Link to comment https://forums.phpfreaks.com/topic/56680-upload-file-without-white-space-in-the-name/#findComment-279984 Share on other sites More sharing options...
maxat Posted June 22, 2007 Author Share Posted June 22, 2007 where to put it? cause I have tried to put it after each line but getting an error. So if you can, please explain. "Notice: Undefined variable: name in C:\htdocs" Link to comment https://forums.phpfreaks.com/topic/56680-upload-file-without-white-space-in-the-name/#findComment-279990 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.