Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- Parsing Picture Upload Not Uploading


rocknbil - 4:06 pm on Apr 24, 2012 (gmt 0)


^ ^ Precisely. :-)

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

tktedmembers/$id/".$newname

$_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)


Thread source:: http://www.webmasterworld.com/php/4442680.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com