lonewolf007 Posted May 2, 2007 Share Posted May 2, 2007 Hello I have a web client and the upload form I have won't write the file to the folder. Here is the code I have. <?php /************************************************* * Micro Upload * * Version: 0.1 * Date: 2006-10-27 * * Usage: * Set the uploadLocation variable to the directory * where you want to store the uploaded files. * Use the version which is relevenat to your server OS. * ****************************************************/ //Windows way $uploadLocation = "/Uploaded"; //Unix, Linux way //$uploadLocation = "\tmp"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html> <head> <title>Upload Files - Dixon Design Services</title> <link href="style.css" rel="stylesheet" type="text/css" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /></head> <body bgcolor="#0000FF" text="#FFFFFF" link="#FFFFFF"> <table width="900" border="0" align="center"> <tr> <th scope="row"><p align="center">Welcome to </p> <p align="center">Dixon Design Services, LLC<br> (231) 929 - 7005</p> <p align="center">Experienced - Reliable - Responsive </p></th> <th scope="row"><div align="center"><img src="/Logouse.JPG" width="166" height="139" alt="Dixon Design Services" longdesc="http://www.dixondesignservices.com" /></div></th> </tr> </table> <p align="center"><SCRIPT src="../displayFlash.js"></SCRIPT></p> <div id="main"> <div id="caption"><strong>UPLOAD FILE</strong></div> <div id="icon"></div> <form action="<?php echo $_SERVER['../PHP_SELF']; ?>" method="post" name="fileForm" id="fileForm" enctype="multipart/form-data"> <div align="center"><strong>File to upload:</strong> </div> <center> <table> <tr><td><input name="upfile" type="file" size="36"></td></tr> <tr><td align="center"><br/><input class="text" type="submit" name="submitBtn" value="Upload"></td></tr> </table></center> </form> <?php if (isset($_POST['submitBtn'])){ ?> <div id="caption">RESULT</div> <div id="icon2"></div> <div id="result"> <table width="100%"> <?php $target_path = $uploadLocation . basename( $_FILES['upfile']['name']); if(move_uploaded_file($_FILES['upfile']['tmp'], $target_path)) { echo "The file: ". basename( $_FILES['upfile']['name']). " has been uploaded!"; } else { switch($_FILES['upfile']['error']) { case 0: echo "There is no error, the file uploaded with success. "; break; // case 1: echo "The uploaded file exceeds the upload_max_filesize directive in php.ini. "; break; // case 2: echo "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form. "; break; // case 3: echo "The uploaded file was only partially uploaded. "; break; // case 4: echo "No file was uploaded. "; break; // case 6: echo "Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3. "; break; // case 7: echo "Failed to write file to disk. Introduced in PHP 5.1.0. "; break; // case 8: echo "File upload stopped by extension. Introduced in PHP 5.2.0. "; break; // default: echo "Unknown error"; } } ?> </table> </div> <?php } ?> <div> </body> Quote Link to comment https://forums.phpfreaks.com/topic/49588-web-site-upload-form-wont-write/ Share on other sites More sharing options...
john010117 Posted May 2, 2007 Share Posted May 2, 2007 First of all, did you set the directory (in which the file will be upload to) to 777? Second of all, did you get any PHP errors? Try putting this: error_reporting(E_ALL); at the very top of the PHP code. Quote Link to comment https://forums.phpfreaks.com/topic/49588-web-site-upload-form-wont-write/#findComment-243115 Share on other sites More sharing options...
lonewolf007 Posted May 2, 2007 Author Share Posted May 2, 2007 okay I put below <?php ( aka line 1 ) error_reporting(E_ALL); Notice: Undefined index: tmp in /home/content/x/o/n/xonid67gn1/html/upload2.php on line 70 this is what i get Quote Link to comment https://forums.phpfreaks.com/topic/49588-web-site-upload-form-wont-write/#findComment-243120 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.