Jump to content

Unable to change profile image.


Scotty13

Recommended Posts

I'm only a rookie, so I would appreciate any help and please don't answer with to complicated replies.Error coming from line 82 (marked below along with script entry).Warning: move_uploaded_file(tktedmembers/24/image01.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/*******/public_html/edit_res.php on line 82Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/php0GS4bb' to 'tktedmembers/24/image01.jpg' in /home/*******/public_html/edit_res.php on line 82 // ------- PARSING PICTURE UPLOAD --------- if ($_POST['parse_var'] == "pic"){ // If a file is posted with the form if ($_FILES['fileField']['tmp_name'] != "") { $maxfilesize = 51200; // 51200 bytes equals 50kb if($_FILES['fileField']['size'] > $maxfilesize ) { $error_msg = '<font color="#FF0000">ERROR: Your image was too large, please try again.</font>'; unlink($_FILES['fileField']['tmp_name']); } else if (!preg_match("/\.(gif|jpg|png)$/i", $_FILES['fileField']['name'] ) ) { $error_msg = '<font color="#FF0000">ERROR: Your image was not one of the accepted formats, please try again.</font>'; unlink($_FILES['fileField']['tmp_name']); } else { $newname = "image01.jpg"; LINE 82: $place_file = move_uploaded_file( $_FILES['fileField']['tmp_name'], "tktedmembers/$id/".$newname); } } } // ------- END PARSING PICTURE UPLOAD ---------I tried everything that "I" could think of.Thanks, Scott

Link to comment
Share on other sites

It sounds like the directory you're trying to move the file to doesn't exist. You have to create it.

if(!file_exists('path/directory/')) {    mkdir('path/directory/');}

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...