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.
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to