working with files
Posted: Fri May 06, 2005 3:36 pm
ok i have a little form that uploads files to a directory and I'm going to link it to a database when the file is uploaded but I need to get the file name, size, etc. Anyone know where I can get the functions (or whatver) for that?
This is the form:
This is what I have for file size and stuff now but it returns wierd values for the name and just returns 'file' for file type.
...and one more thing... is the unlink() function the correct one to use to delete files from a directory?
Thanks for the help. Jr-
Jcart | Please review
Posting Code in the Forums
This is the form:
Code: Select all
<form enctype="e;multipart/form-data"e; action="e;upload.php?action=xxx"e; method="e;post"e;> <? //upload_send ?>
<input type="e;hidden"e; name="e;MAX_FILE_SIZE"e; value="e;943718400"e;>
<? // Limit upload.php will POST is 900-MB but limit upload_send.php will actually send is only 3-MB ?>
<p>Upload This File: <input name="e;userfile"e; type="e;file"e;>
<input type="e;submit"e; value="e;Upload"e;>
</form>Code: Select all
$file_name = basename("$userfile");
$file_type = filetype("$userfile");
$file_size = filesize("$userfile");
$file_exists = file_exists("$userfile");
// $delete_file = unlink("$userfile");
print "<br>File Name: $file_name";
print "<br>File Type: $file_type";
print "<br>File Size: $file_size";
print "<br>File Exists: $file_exists";
// print "<br>File Removed: $delete_file";Thanks for the help. Jr-
Jcart | Please review