im trying to upload a file using php and apache and i get a blank screen when i submit the file. the php and apache are configured correct as i can open a test php file and as the file i want to upload is small there shouldnt be any problem with the size.can anybody help me?
uploading files using php and apache
Collapse
X
-
Tags: None
-
Originally posted by BanfaWhat is the script you upload to supposed to output?
<html>
<head>
<title>file upload</title>
</head>
<body>
<h2>upload</h2>
<FORM ENCTYPE = "multipart/form-data" ACTION = "upload_file.ph p" METHOD = "POST">
<INPUT TYPE = "HIDDEN" NAME = "MAX_FILE_S IZE" VALUE = "20000">
Filename:
<INPUT NAME = "userfile" TYPE = "file">
<BR>
<BR>
<INPUT TYPE = "submit" VALUE = "send">
</FORM>
</BODY>
</HTML>
this is the php upload file:
<?
if ($userfile == "none"){
echo "No file specified";
exit;
}
if (move_uploaded_ file($userfile, "\\uploads\\".$ userfile_name)) {
echo "your file has been uploaded";
}else{
echo "could not upload file";
}
?>Comment
-
When you upload, your file will be located in $_FILES['userfile'] not $userfile.
Originally posted by mollymalonethis is the code for the submit file:
<html>
<head>
<title>file upload</title>
</head>
<body>
<h2>upload</h2>
<FORM ENCTYPE = "multipart/form-data" ACTION = "upload_file.ph p" METHOD = "POST">
<INPUT TYPE = "HIDDEN" NAME = "MAX_FILE_S IZE" VALUE = "20000">
Filename:
<INPUT NAME = "userfile" TYPE = "file">
<BR>
<BR>
<INPUT TYPE = "submit" VALUE = "send">
</FORM>
</BODY>
</HTML>
this is the php upload file:
<?
if ($userfile == "none"){
echo "No file specified";
exit;
}
if (move_uploaded_ file($userfile, "\\uploads\\".$ userfile_name)) {
echo "your file has been uploaded";
}else{
echo "could not upload file";
}
?>Comment
Comment