Jump to content

Help Remove The 'if' Used In This Code


imnewtophp

Recommended Posts

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!";
}
?>

Link to comment
https://forums.phpfreaks.com/topic/269414-help-remove-the-if-used-in-this-code/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.