file upload

file upload

am 24.12.2007 04:59:50 von dev

Hello All,

i am unable to upload file using following code:

chmod("upload", 0777);
move_uploaded_file($_FILES["file"]["tmp_name"], "./upload/".
$_FILES["file"]["name"]);
chmod("upload", 0755);

what wrong in this code any one help me.

Thanks in advance

Dev

Re: file upload

am 24.12.2007 05:10:33 von My Pet Programmer

Dev said:
> Hello All,
>
> i am unable to upload file using following code:
>
> chmod("upload", 0777);
> move_uploaded_file($_FILES["file"]["tmp_name"], "./upload/".
> $_FILES["file"]["name"]);
> chmod("upload", 0755);
>
> what wrong in this code any one help me.
>
> Thanks in advance
>
> Dev

I doubt your PHP process has root access to your server. You'll need to
either change the permissions on the directory you're uploading to
manually outside the program of write a shell script that does it and
call that from PHP, then write another one that locks it back up and
call it from PHP as well, but I'm not even sure that would work, unless
you su'd first, which I don't think I would ever consider doing from PHP.

~A!

Re: file upload

am 24.12.2007 10:33:07 von Betikci Boris

On Dec 24, 5:59=A0am, Dev wrote:
> Hello All,
>
> i am unable to upload file using following code:
>
> chmod("upload", 0777);
> move_uploaded_file($_FILES["file"]["tmp_name"], "./upload/".
> $_FILES["file"]["name"]);
> chmod("upload", 0755);
>
> what wrong in this code any one help me.
>
> Thanks in advance
>
> Dev

What about the other attributes? Did you try 644 or 744 and why do you
give executable status to public?

Re: file upload

am 24.12.2007 23:15:17 von shimmyshack

On Dec 24, 3:59=A0am, Dev wrote:
> Hello All,
>
> i am unable to upload file using following code:
>
> chmod("upload", 0777);
> move_uploaded_file($_FILES["file"]["tmp_name"], "./upload/".
> $_FILES["file"]["name"]);
> chmod("upload", 0755);
>
> what wrong in this code any one help me.
>
> Thanks in advance
>
> Dev

i unable to answer this question based on the proceeding code posted
(maybe post the errors you are getting? just a thought)

Re: file upload

am 25.12.2007 07:15:46 von Tim Roberts

Dev wrote:
>
>i am unable to upload file using following code:
>
>chmod("upload", 0777);
>move_uploaded_file($_FILES["file"]["tmp_name"], "./upload/".
>$_FILES["file"]["name"]);
>chmod("upload", 0755);
>
>what wrong in this code any one help me.

Does the Apache user have write permission in the directory containing
"upload"? If not, you won't be able to chmod the directory. And if
"apache" IS the owner, then you probably don't need it.

What are you trying to protect here? Why don't you just set the
permissions to 775 and have the group be the Apache group?
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.