Seems correct to me, try to upload the file with different browsers. Opera,
Netscape, M$. e.g. Rich Text could be: application/MSword, text/richtext,
and some other "nice" applications.... ;-)

Cheers,

Alex

"Anders Thoresson" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Am I making any obvious mistakes here, in my upload script? I want to
> upload text-files only, they should end up in the directory from which the
> script is executed and be names __traningsmatcher.txt.
>
> HTML-form:
>
> <FORM ENCTYPE="multipart/form-data" METHOD=POST ACTION="store.php">
> <TABLE>
> <INPUT NAME="max_file_size" TYPE="hidden" VALUE="3000000">
> <TR>
> <TD>Fil: </TD>
> <TD><INPUT NAME="userfile" TYPE="file"></TD>
> </TR>
> <TR>
> <TD></TD>
> <TD><INPUT TYPE=submit VALUE=" skicka "></TD>
> </TR>
> </TABLE>
> </FORM>
>
>
> And php, on the recieving end:
> <?php
>
> // check and validate uploaded file
>
> if($_FILES['userfile'] == "none") {
> die("Problem: Ingen fil uppladdad.");
> }
>
>
> if($_FILES['userfile']['size'] == 0) {
> die("Problem: Filen är tom.");
> }
>
> if($_FILES['userfile']['type'] != "text/plain") {
> die("Problem: Filen är inte en textfil.");
> }
>
>
> if(!is_uploaded_file($_FILES['userfile']['tmp_name'])) {
> die("Problem: Filen är inte uppladdad");
> }
>
> $upfile = "__traningsmatcher.txt";
>
> if(!copy($_FILES['userfile']['tmp_name'], $upfile)) {
> die("Kunde inte spara filen");
> }
>
> echo("Filen är sparad!");
>
>
> ?>
>
> --
> anders thoresson



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

Reply via email to