imnewtophp Posted October 13, 2012 Share Posted October 13, 2012 I have created a member system that saves the user data into a mysql table. I am now trying to allow users to upload a picture. I have found the following code that works. However I want to use it within the code I have already. When I try and remove the 'if' function it no longer works. What do I need to remove/add to just have it upload the image to my host and not echo anything back? <?php $target_path = "uploads/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/269414-help-remove-the-if-used-in-this-code/ Share on other sites More sharing options...
imnewtophp Posted October 13, 2012 Author Share Posted October 13, 2012 It was as simple as I thought. However, when testing it I was trying to upload pictures that had spaces in the filename. I guess this is a different problem. It works fine with a normal file name. Quote Link to comment https://forums.phpfreaks.com/topic/269414-help-remove-the-if-used-in-this-code/#findComment-1384937 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.