Killersites Community: Can't Upload & Chg image - PARSING PICTURE UPLOAD - Killersites Community

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Can't Upload & Chg image - PARSING PICTURE UPLOAD

#1 User is offline   Scotty13 

  • PipPipPip
  • View blog
  • Group: Member
  • Posts: 62
  • Joined: 19-February 10

Posted 13 April 2012 - 02:50 PM

If its not one thing its another. Im a newbie just trying to build a social network website from some tutorials online.

When I try to change my picture, I get these errors…

Warning: move_uploaded_file(members/6/image01.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/******/public_html/edit_res.php on line 70

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/php7MzLn5' to 'members/6/image01.jpg' in /home/******/public_html/edit_res.php on line 70

Warning: move_uploaded_file(members/6/image01.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/******/public_html/edit_res.php on line 95

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/php7MzLn5' to 'members/6/image01.jpg' in /home/******/public_html/edit_res.php on line 95

(Lines 70 & 95 are marked below)

// ------- IF WE ARE PARSING ANY DATA -----------------------------------------------------

if (!isset($_POST['parse_var']))
{
$_POST['parse_var'] = "undefined";
}
if($_POST['parse_var'] == "undefined")
{
//Code to handle undefined exception
}

if ($_POST['parse_var'] == "pic"){
// If a file is posted with the form
if ( isset($_FILES['fileField']) && ! empty($_FILES['fileField']['tmp_name']) ) {
$maxfilesize = 2097152; // equal to 2 mb
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 70) $place_file = move_uploaded_file( $_FILES['fileField']['tmp_name'], "members/$id/".$newname);
}
}
}
// ------- 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 95) $place_file = move_uploaded_file( $_FILES['fileField']['tmp_name'], "members/$id/".$newname);
}
}
}
// ------- END PARSING PICTURE UPLOAD ---------


THANK YOU FOR YOUR HELP!
Scott
0

#2 User is offline   Scotty13 

  • PipPipPip
  • View blog
  • Group: Member
  • Posts: 62
  • Joined: 19-February 10

Posted 13 April 2012 - 02:55 PM

FIXED IT!!! The entry is good, I missed a word that I had changed in other scripts and didnt see it on this sections.
0

#3 User is offline   hamge 

  • View blog
  • Group: New Members
  • Posts: 2
  • Joined: 23-June 12

Posted 08 July 2012 - 08:11 PM

i dont know the code and steps on how to create an upload script.. help me please
0

#4 User is offline   Ben 

  • View blog
  • Group: Administrators
  • Posts: 5,409
  • Joined: 19-December 08
  • LocationChico, CA

Posted 08 July 2012 - 09:08 PM

View Posthamge, on 08 July 2012 - 06:11 PM, said:

i dont know the code and steps on how to create an upload script.. help me please

Search for "php upload tutorial". There are a lot of tutorials available online.
Benjamin Falk | Falken Creative : Twitter : KillerSites Screencast Blog
Skills: Photoshop, Illustrator, HTML, CSS, jQuery, PHP and CodeIgniter
0

#5 User is offline   hamge 

  • View blog
  • Group: New Members
  • Posts: 2
  • Joined: 23-June 12

Posted 15 July 2012 - 10:08 PM

View PostBen, on 09 July 2012 - 10:08 AM, said:

Search for "php upload tutorial". There are a lot of tutorials available online.



ok sir..thanks B)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users