File Upload problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mariolopes
Forum Contributor
Posts: 102
Joined: Sun May 22, 2005 7:08 am

File Upload problem

Post by mariolopes »

Hi i have the my file upload like that

Code: Select all

 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html>
 <head>
 <title>Como fazer o Upload de um ficheiro</title>
 </head>
 <body>
 <div>
 <?php
 if ( isset( $_FILES['fupload'] ) ) {
 $source = $_FILES['fupload']['tmp_name'];
 echo $source;
 echo "<br/>";
 $target = $_FILES['fupload']['name'];
 echo $target;
 move_uploaded_file( $source, $target );
 /*
 $size = getImageSize( $target );
 $imgstr = "<p><img width=\"$size[0]\" height=\"$size[1]\" ";
 $imgstr .= "src=\"$target\" alt=\"Imagem enviada\" /></p>";
 print $imgstr;
// }
*/
 }
 ?>
 </div>
 <form enctype="multipart/form-data"
 action="" method="post">
 <p>
 <input type="hidden" name="MAX_FILE_SIZE" value="10240000" />
 <input type="file" name="fupload" /><br/>
 <input type="submit" value="upload!" />
 </p>
 </form>
 </body>
 </html>
 
But i have to create one html file and a separate one php file. How can i get the values of
$source = $_FILES['fupload']['tmp_name'];
in my php file?
Thank you
Post Reply