Re: Problem with uploading Files with PHP 4.1.2 on IIS
| From: | Evan | Date: | Tue, 16 Apr 2002 08:50:22 +0000 |
| Subject: | Re: Problem with uploading Files with PHP 4.1.2 on IIS | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-13120@lists.php.net to get a copy of this message | ||
This works for me:
if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) {
//Get the extension
$split_nomefile = explode(".",$_FILES['userfile']['name']);
$ext = $split_nomefile[ count($split_nomefile)-1 ];
//Create the new filename
$NomeFile =
$_POST["Materia"]."_".date("Y-m-d-H-i-s").".".$ext;
//Move from tmp-dir to my "upload" directory
copy($HTTP_POST_FILES['userfile']['tmp_name'],
"../../files/".$NomeFile);
move_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'],
"../../files/".$NomeFile);
}
Hope this will help you.
Bye,
Evan
"Uhaj" <uhaj@atlas.cz> ha scritto nel messaggio
news:20020416053302.70415.qmail@pb1.pair.com...
> I have problem with uploading files - have anyone some idea?
>
> php.ini:
> .....
> file_uploads = On
> upload_tmp_dir = C:\Inetpub\Upload\
> upload_max_filesize = 4M
> .....
>
> upload.php:
> <?
> if (is_uploaded_file($userfile))
> {
> echo "Name : ".$userfile ."<BR>\n";
> echo "Orign : ".$userfile_name ."<BR>\n";
> echo "Type : ".$userfile_type ."<BR>\n";
> echo "Size: ".$userfile_size."<BR>\n";
> }
> ?>
> <BODY BGCOLOR=#FFFFFF>
> <FORM ENCTYPE="multipart/form-data" ACTION="upload.php"
> METHOD=POST>
> <INPUT TYPE="hidden" name="MAX_FILE_SIZE"
> value="4000000">
> Send this file: <INPUT NAME="userfile" TYPE="file">
> <INPUT TYPE="submit" VALUE="Send File">
> </FORM>
> </BODY>
>
> The response seems OK, but new file is not on hard drive
> Response:
> Name : C:\Inetpub\Upload\php14E4.tmp
> orign : Test.doc
> Type : application/msword
> size: 19456
>
> Thanks
>
>