gterre Posted August 23, 2006 Share Posted August 23, 2006 I am trying to successfuly run a file upload script, however when i press the submit button, I get the following error[img]http://www.geocities.com/gpterre/images/forbidden404.jpg[/img]my code is as follows:<?php$maxsize=28480; //set the max upload size in bytesif (!$HTTP_POST_VARS['submit']) { //print_r($HTTP_POST_FILES); $error=" ";//this will cause the rest of the processing to be skipped//and the upload form displays}if (!is_uploaded_file($HTTP_POST_FILES['upload_file']['tmp_name']) AND!isset($error)) { $error = "<b>You must upload a file!</b><br><br>"; unlink($HTTP_POST_FILES['upload_file']['tmp_name']);}if ($HTTP_POST_FILES['upload_file']['size'] > $maxsize AND !isset($error)) { $error = "<b>Error, file must be less than $maxsize bytes.</b><br><br>"; unlink($HTTP_POST_FILES['upload_file']['tmp_name']);}if($HTTP_POST_FILES['upload_file']['type'] != "image/gif" AND$HTTP_POST_FILES['upload_file']['type'] != "image/pjpeg" AND$HTTP_POST_FILES['upload_file']['type'] !="image/jpeg" AND !isset($error)) { $error = "<b>You may only upload .gif or .jpeg files.</b><br><br>"; unlink($HTTP_POST_FILES['upload_file']['tmp_name']);}if (!isset($error)) {copy($HTTP_POST_FILES['upload_file']['tmp_name'],"uploads/".$HTTP_POST_FILES['upload_file']['name']); unlink($HTTP_POST_FILES['upload_file']['tmp_name']); print "Thank you for your upload."; exit;}else{ echo ("$error");}?><html><head></head><body><form action="<?=$PHP_SELF?>" method="post" enctype="multipart/form-data">Choose a file to upload:<br><input type="file" name="upload_file" size="40"><br><input type="submit" name="submit" value="submit"></form></body></html>Also on another note, I cannot access phpfreaks.com or any of its directory pages.. All i get is a blank page, and this is on the computer that i installed wamp on which has php mysql and apache on it. can someone please help me with this because it is a pain transfering information from on computer to another just to request for help on this forum. thanks. Link to comment https://forums.phpfreaks.com/topic/18482-forbidden-404-error-file-upload-unable-to-load-phpfreakscom/ Share on other sites More sharing options...
hitman6003 Posted August 23, 2006 Share Posted August 23, 2006 change:[code]<?=$PHP_SELF?>[/code]to:[code]<?php echo $_SERVER['PHP_SELF']; ?>[/code] Link to comment https://forums.phpfreaks.com/topic/18482-forbidden-404-error-file-upload-unable-to-load-phpfreakscom/#findComment-79559 Share on other sites More sharing options...
gterre Posted August 23, 2006 Author Share Posted August 23, 2006 Thank you soooooo much, it worked :)now i just need help in viewing phpfreaks.com / I have no idea why i'm not able to view it on my computer. Link to comment https://forums.phpfreaks.com/topic/18482-forbidden-404-error-file-upload-unable-to-load-phpfreakscom/#findComment-79570 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.