Re: upload file problem
| From: | Richard Lynch | Date: | Mon, 11 Jul 2005 01:34:10 +0000 |
| Subject: | Re: upload file problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-218408@lists.php.net to get a copy of this message | ||
On Sat, July 9, 2005 1:39 am, Ahmed Abdel-Aliem said:
> Hi
> i have a problem with a code to upload files on server
> here is the code
>
> $f =& $HTTP_POST_FILES['News_Pic'];
Use $_FILES to stay current...
> $dst_file_name = generateUniqueId();
>
> $arr = split("\.",$f['name']);
>
> $f['name'] = $dst_file_name;
>
> $f['name'] .= ".".$arr[count($arr)-1];
>
> $dest_dir = 'main/pictures';
>
> $dest = $dest_dir . '/' .$f['name'];
So, what happened to $dst_file_name?
Far as I can tell, you've never used it...
> $r = move_uploaded_file($f['tmp_name'], $dest);
> $News_Pic = $f['name'];
> chmod($dest, 777);
Nooooooooooooooo!
You should *NOT* be trying to make the files 777.
And it should be 0777 anyway.
--
Like Music?
http://l-i-e.com/artists.htm