01272006 1413 GMT-6
Im working on a tutorial on file-uploads.
The tutorial is specifically for a mac but he author said its similar to
Linux.
This is my directory structure:
/var/www
/tmp
/kt
/lu
My script is in the /lu folder.
The temporary upload is /var/www/tmp
What I want to do is upload a file and then save it to its final
destination of /kt.
Here is the php code:
if (isset ($_POST['submit'])) {
// Try to move the upload file.
if (move_uploaded_file ($_FILES['thefile']['tmp'],
"/var/www/KimTate/homes/{$_FILES['thefile']['name']}")) {
print '<p>Your file has been uploaded.</p>';
} else {
// A Problem!
print '<p>Your file could not be uploaded because: <b>';
// Print a message based upon the error.
switch ($_FILES['thefile']['error']) {
case 1:
print 'The file exceeds the upload_max_filesize
setting in the php.ini';
break;
case 2:
print 'The file exceeds the MAX_FILE_SIZE
setting in the form';
break;
case 3:
print 'The file was only partially uploaded';
break;
case 4:
print 'No file was uploaded';
break;
}
print '</b></p>';
}
} // End of SUBMIT IF
When I run this script at first I received a MAX FILE SIZE error but the
file is only 15kb. The form has a hidden input of <input type="hidden"
name="MAX_FILE_SIZE" value="30000" />.
But when I ran the script again after verifying the file size, I do not
get any error messages.
Wade
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/