beennn Posted May 29, 2012 Share Posted May 29, 2012 Here's what I have: $target = "images/profile_pictures/";$target = $target . basename( $_FILES['fileBrowser']['name']);$pic=($_FILES['fileBrowser']);mysql_query("UPDATE `user_accounts` SET profile_picture=$pic WHERE email =$Email") ; if(move_uploaded_file($_FILES['fileBrowser']['tmp_name'], $target)) { echo "The file ". basename( $_FILES['uploadedfile']['fileBrowser']). " has been uploaded, and your information has been added to the directory"; } else { echo "Sorry, there was a problem uploading your file."; } However I get errors at: $target = $target . basename( $_FILES['fileBrowser']['name']); $pic=($_FILES['fileBrowser']); if(move_uploaded_file($_FILES['fileBrowser']['tmp_name'], $target)) I found out how to do this originally at: http://php.about.com/od/phpwithmysql/ss/Upload_file_sql.htm If someone could give me a hint at what's wrong, id be greatful Link to comment Share on other sites More sharing options...
Don E Posted May 29, 2012 Share Posted May 29, 2012 (edited) For this: $target = $target . basename( $_FILES['fileBrowser']['name']); You can just have: $target = $target . $_FILES['fileBrowser']['name']; This $pic=($_FILES['fileBrowser']);, you're probably wanting to do this: $pic = $_FILES['fileBrowser']['name']; Edited May 29, 2012 by Don E Link to comment Share on other sites More sharing options...
justsomeguy Posted May 29, 2012 Share Posted May 29, 2012 If you're getting an error every time you try to access the item in the $_FILES array then it probably doesn't exist. You can use print_r to print out the entire array to check it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now