Jump to content

Trouble with uploading images


Recommended Posts

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']);


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

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 by Don E
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...