By no errors, do you mean you have a PHP version greater
than PHP 4.2.0 and checked the ['error'] code, and it
has a value of 0?  Are you sure you want the filename
to be $file_name?  I doubt you do.

Regards,
Philip

ref: http://www.php.net/features.file-upload

On Sat, 7 Jun 2003, Rodney Green wrote:

> Hello. I'm attempting to upload a file using the script below and I'm not
> having any success. The temp directory I'm using does exist and is
> writeable. When I browse for the file then hit the send button it appears to
> be working then displays the form again with no errors. I look for the file
> on the server and it isn't there. Any advice on how to get this working?
> 
> Thanks!
> Rod
> 
> 
> ---------------------------------------------------------------
> 
> <html>
> <head>
> <title>Listing 9.14 A file upload script</title>
> </head>
> <?php
> $file_dir = "/home/corrdev/htdocs/php24/scrap/uploads";
> $file_url = "http://corros.colo.hosteurope.com/dev/php24/scrap/uploads";;
> 
> foreach( $HTTP_POST_FILES as $file_name => $file_array ) {
>  print "path: ".$file_array['tmp_name']."<br>\n";
>  print "name: ".$file_array['name']."<br>\n";
>  print "type: ".$file_array['type']."<br>\n";
>  print "size: ".$file_array['size']."<br>\n";
> 
>  if ( is_uploaded_file( $file_array['tmp_name'] )
>   && $file_array['type'] == "image/gif" ) {
>   move_uploaded_file( $file_array['tmp_name'], "$file_dir/$file_name")
>    or die ("Couldn't copy");
>   print "<img src=\"$file_url/$file_name\"><p>\n\n";
>  }
> }
> 
> ?>
> <body>
> <form enctype="multipart/form-data" method="POST">
> <input type="hidden" name="MAX_FILE_SIZE" value="51200">
> <input type="file" name="fupload"><br>
> <input type="submit" value="Send file!">
> </form>
> </body>
> </html>
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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

Reply via email to