Forum Thread
  Posts  
File Uploading (PHP) (Forums : Coding & Scripting : File Uploading (PHP)) Locked
Thread Options
jacksonj04
jacksonj04 Over 9000
Apr 2 2003 Anchor

Error:

Warning: Unable to create 'images/up/1': Is a directory in /home/sites/site187/web/tm/ad_up.php on line 13

Code Creating Error:

copy($_FILES['userfile']['tmp_name'], "images/up/$authuser->UID")

Folder:
Exists
CHMOD 777

--

Barcode Imagejacksonj04 the generally helpful one
Lost, confused or just need a virtual cuddle? PM me.
Need urgent help from staff? PM us all.

Apr 2 2003 Anchor

:confused:

INtense!
INtense! End Boss
Apr 2 2003 Anchor

try the function move_uploaded_file() instead of copy

www.php.net/move_uploaded_file

some servers disable the copy() function but from what I see that is not what is causing the error?

echo this variable for us: images/up/$authuser->UID then we maybe able to see what is happening.. what dir is the script running from?

--

Scott Reismanis
DBolical | @scottreismanis

jacksonj04
jacksonj04 Over 9000
Apr 3 2003 Anchor

i tried move_uploaded_file all I got was the same error, plus an extra bit about not being able to move an uploaded file.

echo ("images/up/$authuser->UID");

gives

images/up/1

the directory is the root of the site (/web/tm) trying to find /web/tm/images/up/1 but even if I use the full path I get the same error.

--

Barcode Imagejacksonj04 the generally helpful one
Lost, confused or just need a virtual cuddle? PM me.
Need urgent help from staff? PM us all.

INtense!
INtense! End Boss
Apr 3 2003 Anchor

jacksonj04 wrote: i tried move_uploaded_file all I got was the same error, plus an extra bit about not being able to move an uploaded file.

echo ("images/up/$authuser->UID");

gives

images/up/1

the directory is the root of the site (/web/tm) trying to find /web/tm/images/up/1 but even if I use the full path I get the same error.

Ok thats where I thought you were going wrong.. you are meant to specify the file name in the destination...

.i.e. instead of images/up/1 it should be images/up/file.exe or images/up/1/file.exe

not just the folder ;)

--

Scott Reismanis
DBolical | @scottreismanis

jacksonj04
jacksonj04 Over 9000
Apr 3 2003 Anchor

it makes so much sense now!

I know why i b0rked it, I use the CHM manual, which says this:

if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
copy($_FILES['userfile']['tmp_name'], "/place/to/put/uploaded/file");
} else {
echo "Possible file upload attack. Filename: " . $_FILES['userfile']['name'];
}

- Edited By jacksonj04 On Thu 3rd, Apr 2003 @ 3:08:29pm

--

Barcode Imagejacksonj04 the generally helpful one
Lost, confused or just need a virtual cuddle? PM me.
Need urgent help from staff? PM us all.

INtense!
INtense! End Boss
Apr 4 2003 Anchor

sweet :D :thumbup:

--

Scott Reismanis
DBolical | @scottreismanis

Reply to thread
click to sign in and post

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.