Switch to full style
:read: Start PHP with us. Includes topics to help you in php
Post a reply

show uploaded file name, size and type

Sun Oct 26, 2008 9:35 pm

Code:
<html>
<head>
<title>A file upload script</title>
</head>
<?php
$file_dir
= ".";
$file_url = ".";
if ( isset(
$fupload ) ){
   print
"path: $fupload<br>\n";
   print
"name: $fupload_name<br>\n";
   print
"size: $fupload_size bytes<br>\n";
    print
"type: $fupload_type<p>\n\n";
   if (
$fupload_type == "image/gif" ){
     
copy ( $fupload, "$file_dir/$fupload_name") or die ("Couldn't copy");
     print
"<img src=\"$file_url/$fupload_name\"><p>\n\n";
   }
}
?>
<body>
<form enctype="multipart/form-data" action="<?php print $PHP_SELF?>" method="POST">
    <input type="hidden" name="MAX_FILE_SIZE" value="51200">
    <input type="file" name="fupload">
    <input type="submit" value="Send file!">
</form>
</body>
</html>




Post a reply
  Related Posts  to : show uploaded file name, size and type
 Read double values type from file in java     -  
 show all drivers in file system     -  
 Change Image File Size (Height And Width) While Uploading     -  
 Set image size as a percentage of the page size     -  
 Encrypt/Decrypt a file from source file to target file.     -  
 Type Conversion     -  
 Type conversions     -  
 Array size to zero     -  
 Nav button size     -  
 get string size in c++     -  

Topic Tags

PHP Forms