Hey. I've been playing with file uploads, but have been having a few problems with it. I am running it locally on my work computer, but for some reason the uplooaded file comes up as 'none', the path comes up ok, the size always comes out at zero and the type comes out ok. Here is an examples of what I see;
The name and path of file is atpbase.sys
The size of file is 0
The size of file is application/octet-stream
The code I am using is;
if (!$uploadfile) { show_html(); } else { sendmain($uploadfile, $HTTP_POST_FILES['uploadfile']['name'], $HTTP_POST_FILES['uploadfile']['size'], $HTTP_POST_FILES['uploadfile']['type']); }
function show_html() {
?>
<form enctype="multipart/form-data" action="attach.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="1000">
Send this file: <input name="uploadfile" type="file">
<input type="submit" value="Send File">
</form>
<?
} // end the show html part
function sendmain($uploadfile_1, $uploadfile_2, $uploadfile_3, $uploadfile_4) {
echo "The name and path of file is $uploadfile_1<BR>";
echo "The name and path of file is $uploadfile_2 <BR>";
echo "The size of file is $uploadfile_3 <BR>";
echo "The size of file is $uploadfile_4 <BR>";
copy($uploadfile_1, "c:\\test\\test.txt");
}
function error($error) {
echo $error;
exit;
} // end the error sub
?>
and then URL i am referencing this from is the PHP.net site (http://www.php.net/...ures.file-upload.php).
Anyone ever played with file uploads and can give me a hand? I'm running PHP 4.0.6, which I think is the latest release.
Thanks
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Code:
The name and path of file is none The name and path of file is atpbase.sys
The size of file is 0
The size of file is application/octet-stream
The code I am using is;
Code:
<?php if (!$uploadfile) { show_html(); } else { sendmain($uploadfile, $HTTP_POST_FILES['uploadfile']['name'], $HTTP_POST_FILES['uploadfile']['size'], $HTTP_POST_FILES['uploadfile']['type']); }
function show_html() {
?>
<form enctype="multipart/form-data" action="attach.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="1000">
Send this file: <input name="uploadfile" type="file">
<input type="submit" value="Send File">
</form>
<?
} // end the show html part
function sendmain($uploadfile_1, $uploadfile_2, $uploadfile_3, $uploadfile_4) {
echo "The name and path of file is $uploadfile_1<BR>";
echo "The name and path of file is $uploadfile_2 <BR>";
echo "The size of file is $uploadfile_3 <BR>";
echo "The size of file is $uploadfile_4 <BR>";
copy($uploadfile_1, "c:\\test\\test.txt");
}
function error($error) {
echo $error;
exit;
} // end the error sub
?>
and then URL i am referencing this from is the PHP.net site (http://www.php.net/...ures.file-upload.php).
Anyone ever played with file uploads and can give me a hand? I'm running PHP 4.0.6, which I think is the latest release.
Thanks
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!