Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Parsing Picture Upload Not Uploading

10:12 pm on Apr 18, 2012 (gmt 0)

Junior Member

5+ Year Member

joined:Feb 23, 2012
posts: 91
votes: 0

Warning: move_uploaded_file(tktedmembers/6/image01.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/myglobal/public_html/edit_res.php on line 92 (marked below)
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpzPTsIn' to 'tktedmembers/6/image01.jpg' in /home/myglobal/public_html/edit_res.php on line 92

// ------- 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>';

} 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>';

} else {
$newname = "image01.jpg";
LINE 92: $place_file = move_uploaded_file( $_FILES['fileField']['tmp_name'], "tktedmembers/$id/".$newname);
// ------- END PARSING PICTURE UPLOAD ---------

Thanks in advance
7:44 am on Apr 24, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 30, 2007
votes: 0

Have you checked is the destination path valid "tktedmembers/$id/".$newname and accessible? And you may want to give an absolute path.
4:06 pm on Apr 24, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
votes: 0

^ ^ Precisely. :-)

This is the exact same issue discussed in your other thread a few days ago. Instead of


$_SERVER['DOCUMENT_ROOT'] . "/tktedmembers/$id/$newname"

(Note that scalar variables will interpolate when double quoted, eliminating some of the concatenation

Make sure the directory exists and it's writable (file permissions.) You should use a good error trap here:

if (is_dir($_SERVER['DOCUMENT_ROOT'] . "/tktedmembers/$id") and is_writable($_SERVER['DOCUMENT_ROOT'] . "/tktedmembers/$id")) {
// do it
else {
die("OOPS! " . $_SERVER['DOCUMENT_ROOT'] . \"/tktedmembers/$id/$newname\" is not a directory OR if it is, it's not writable.");

is_writable() [php.net]
is_dir() [php.net] (also is_file will be useful at some point in any upload scheme)

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members