Re: upload files
| From: | Chad Cotton | Date: | Sat, 26 Oct 2002 18:42:39 +0000 |
| Subject: | Re: upload files | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-121530@lists.php.net to get a copy of this message | ||
I just wrote a file upload script and all the information that I needed was
here in the manual:
http://www.php.net/manual/en/features.file-upload.php
There were a couple of "common pitfalls" that it points out, which you
should check. Make sure you've defined the various configuration variables
'correctly' some are:
upload_files
upload_tmp_dir
upload_max_filesize
and post_max_filesize
also check your form to make sure you have an input defined for
MAX_FILE_SIZE and that in the <form ... > tag you have the proper encoding.
My form used '<form enctype="multipart/form-data" >' and this made a
difference. Something worth checking.
Chadly
"Cyrille Andres" <Cyrille.Andres@icn.siemens.com> wrote in message
news:FA432D4D6C2EC1498940A59C494F1538035E2860@stca207a.bus.sc.rolm.com...
>
>
>
> Hello everybody,
>
>
> I want to allow the client to upload a text file on my web server, so I
use
> this code :
>
> <html>
> <head></head>
> <body>
> Uploaded files details<br>
>
> <?php
> printf("Name : %s <br>",
> $HTTP_POST_FILES["userfile"]["name"]);
> printf("Temporary Name : %s <br>",
> $HTTP_POST_FILES["userfile"]["tmp_name"]);
> printf("Size : %s <br>",
> $HTTP_POST_FILES["userfile"]["size"]);
> printf("Type : %s <br>",
> $HTTP_POST_FILES["userfile"]["type"]);
>
> if (copy
>
($HTTP_POST_FILES["userfile"]["tmp_name"],"temp/".$HTTP_POST_FILES["userfile
> "]["name"]))
> {
> printf("File successfully copied");}
> else{
> printf("Error: failed to copy file");}
>
>
> ?>
>
> </body>
> </html>
>
> the $http_post_files doesn't return me anything, anybody would have a clue
> ?? ( roughly speaking I am not able to retrieve the field the client try
to
> send me).
>
> Thanks a lot.