947740 Posted July 23, 2008 Share Posted July 23, 2008 Is this PHP code correct?: if(!isset($_POST['MAX_FILE_SIZE']) || $_POST['filename'] == "") { echo <<<END <form enctype="multipart/form-data" method='POST' action='upload.php'> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> <!--Destination (Include slash afterwards): <input type='text' name='destination' /><br />--> File: <input type='file' name='filename' /><br /> <input type='submit' name='uploaded' value='Upload' /><br /> </form> END; } else { $destination = 'uploads/'.basename($_FILES['filename']['name']); echo $destination; move_uploaded_file($_FILES['filename']['tmp_name'],$destination) or die("could not upload"); } EDIT: the file this is in is called upload.php. I do not think it is even trying to upload anything. I press submit, and I think it just refreshes without doing anything. Link to comment https://forums.phpfreaks.com/topic/116249-file-not-uploading/ Share on other sites More sharing options...
jonsjava Posted July 23, 2008 Share Posted July 23, 2008 added a check to your script: <?php if (isset($_GET['upload']) && $_GET['upload'] == "success"){ print "<center><strong>Uploaded file!</strong></center>"; } if(!isset($_POST['MAX_FILE_SIZE']) || $_POST['filename'] == "") { echo <<<END <form enctype="multipart/form-data" method='POST' action='upload.php'> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> <!--Destination (Include slash afterwards): <input type='text' name='destination' /><br />--> File: <input type='file' name='filename' /><br /> <input type='submit' name='uploaded' value='Upload' /><br /> </form> END; } else { $destination = 'uploads/'.basename($_FILES['filename']['name']); echo $destination; move_uploaded_file($_FILES['filename']['tmp_name'],$destination) or die("could not upload"); header("location:?upload=success"); exit(); } Link to comment https://forums.phpfreaks.com/topic/116249-file-not-uploading/#findComment-597823 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.