Re: Re: [PHP] file uploads problem
| From: | Jaski | Date: | Tue, 24 Sep 2002 06:16:08 +0000 |
| Subject: | Re: Re: [PHP] file uploads problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-117375@lists.php.net to get a copy of this message | ||
Thanks .. but I think you are saying exactly what I wrote I was doing .. except that you have used exec("cp $file $path") while I tried PHP's copy() function .. I don't think that will make a difference...though will give that a try any way.
Forgot to mention in my previous mail that the directory where I am trying to copy the uploaded file from /tmp is in 777 mode already.
Jaski
On Tue, 24 Sep 2002 Oscar F wrote :
Try: $upload = "/path/to/copy/"; $upload_path = "$upload/$file_filename"; if (is_uploaded_file($file)) { Exec("cp $filename $upload_path"); } Then you have the file at /path/to/copy/<filename>, and you can do whatever you want with it. (I'm assuming the file field of the form is called "file", and that /path/to/copy/ has permissions set so that PHP can write to it, 777 will work for sure, but I'm not 100% positive which one would be best due to security and stuff.). HTH. Oscar.- Jaski wrote:Hi, (Linux RH 7.1, Apache/1.3.22, PHP 4.0.6). I am trying to write a script to send emails. It needs to support attachments. The point where I am stuck is after the file to be attached gets uploaded to /tmp as /tmp/tempfilename thorough an HTTP POST form. I am not able to open that file directly .. follwing error shows up. Warning: fopen("/tmp/phpOaILXx","rb") - Operation not permitted in /var/www/vhosts/mydomain/httpsdocs/lib/email.inc.php on line 254 I tried to copy this file using move_uploaded_file($userfile, "/place/to/put/uploaded/file"); and here a strange thing happened. The file was successfully copied BUT it had permissions like -rw------ which I interpret as only accessible to root. I tried copy() function instead and it failed. I think I have tried every thing I could think of .. so please HELP :) jaski NP. I am subscribed to the digest version so kindly cc any replies to me as well. Thanks.