RES: [PHP] file upload
| From: | Augusto Cesar Castoldi | Date: | Wed, 04 Apr 2001 01:29:47 +0000 |
| Subject: | RES: [PHP] file upload | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-46934@lists.php.net to get a copy of this message | ||
I think my php server is not good.
I did "copy($arqcliente, "/home/httpd/html/admin/$arqcliente_name");"
It didn't work. Then I tried to print both variables, and $arqcliente
printed "C:\\Augusto\\temp.txt" and the $arqcliente_name printed nothing!
echo "arqcliente =$arqcliente<br>";
echo "arqcliente_name =$arqcliente_name<br>";
It's strange because I read the same thing that you told before.
I have the right permissions for httpd that folder. Because I can write in a
file in this server folder.
regards,
Augusto
-----Mensagem original-----
De: Andrew Rush [mailto:andy@mainetoday.com]
Enviada em: terça-feira, 3 de abril de 2001 18:05
Para: Augusto Cesar Castoldi
Assunto: Re: [PHP] file upload
on 4/3/01 4:51 PM, Augusto Cesar Castoldi at castoldi@inf.ufsc.br wrote:
> hehe, I forgot.
>
> I'm getting this error messagem:
> ---------------------
> Warning: Unable to open 'F:\\Augusto\\Augusto.wri' for reading: No such
> file or directory in /home/httpd/html/admin/upload.php3 on line 5
sounds like you are trying to copy a file that doesn't exist. PHP doesn't
upload the file data with the name from the uploader's local filesystem, it
creates a temporary name which is available as a variable with the same name
as the file input on the form. so if you have:
<input type="file" name="myFile">
when handling the form there will be a variable name "$myFile". this will
contain the file data. the original name of the file is available as the
name of the file input with "_name" appended. in the case given the value
for "$myFile_name" would be "Augusto.wri". so you will want to do:
copy($myFile, "path/to/my/folder/for/$myFile_name");
you should end up with the file data in the proper place.
one last thing- make sure that the user who runs the webserver has write
permission for the folder you want to copy into. i can't tell you how many
times this step trips people up- myself included.
have a great day
andy
--
*******************************************************
Andrew Rush :: Lead Systems Developer :: MaineToday.com
*******************************************************
"A friend of the devil is a friend of mine" - R. Hunter