travelkind Posted November 20, 2009 Share Posted November 20, 2009 I am trying to create an area (in a webpage) where someone can upload a file directly to my server. I am getting an error that says: // Where the file is going to be placed $target_path = "/html/beer/uploads/"; /* Add the original filename to our target path. Result is "/html/beer/uploads/filename.csv" */ $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); $target_path = "/html/beer/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!"; } I can't figure out where the error in my code is: // Where the file is going to be placed $target_path = "/html/beer/uploads/"; /* Add the original filename to our target path. Result is "/html/beer/uploads/filename.csv" */ $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); $target_path = "/html/beer/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!"; } Maybe there is an easier way to do this? Any help would be appreciated. Link to comment https://forums.phpfreaks.com/topic/182328-php-upload-csv-file/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.