silverglade Posted December 12, 2011 Share Posted December 12, 2011 Hi, i want to make an image gallery, this is the first step. uploading files. below is the code I am using , but don't i have to include info about the server? i dont know what to include since it is the server I am working with and not a database, any help greatly appreciated. thanks <?php // Where the file is going to be placed $target_path = "uploads/"; /* Add the original filename to our target path. Result is "uploads/filename.extension" */ $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!"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/252966-uploading-images-to-a-directory/ Share on other sites More sharing options...
silverglade Posted December 12, 2011 Author Share Posted December 12, 2011 nevermind, i guess it just assumes its in the public html directory that the php file is in. lol oops. it works, suwheet . thanks. it works Quote Link to comment https://forums.phpfreaks.com/topic/252966-uploading-images-to-a-directory/#findComment-1296977 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.