hujh2012 Posted May 2, 2012 Share Posted May 2, 2012 Does anyone know what would cause this error: Notice: Undefined index: file in C:\Inetpub\wwwroot\Upload\uploader3.php on line 2 No file specified with these files for uploading images: uploader.htm <html><head><title>File Uploader</title></head> <body><h3>File Upload</h3> Select a file to upload:<br> <form action="uploader.php" method="post" enctype="multipart/form-data"> <input type="file" name="file" size="45"> <br> <input type="submit" value="Upload File"> </form> </body></html> and, uploader.php <?php if( $_FILES['file']['name'] != "" ) { copy ( $_FILES['file']['tmp_name'], "C:/Inetpub/wwwroot/Upload/" . $_FILES['file']['name'] ) or die( "Could not copy file" ); } else{ die( "No file specified" ); } ?> <html> <head><title>Upload Complete</title></head> <body> <h3>File Upload Succeeded...</h3> <ul> <li>Sent: <?php echo $_FILES['file']['name']; ?> <li>Size: <?php echo $_FILES['file']['size']; ?> bytes <li>Type: <?php echo $_FILES['file']['type']; ?> </ul> <a href="<?php echo "C:/Inetpub/wwwroot/Upload/".$_FILES['file']['name']; ?>"><img src="<?php echo "C:/Inetpub/wwwroot/Upload/".$_FILES['file']['name']; ?>" height="200"></a> </body> </html> Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/261936-some-errors-need-help/ Share on other sites More sharing options...
QuickOldCar Posted May 2, 2012 Share Posted May 2, 2012 http://www.tizag.com/phpT/fileupload.php // Where the file is going to be placed $target_path = "Upload/"; /* Add the original filename to our target path. Result is "Upload/filename.extension" */ $target_path = $target_path . basename( $_FILES['file']['name']); Quote Link to comment https://forums.phpfreaks.com/topic/261936-some-errors-need-help/#findComment-1342204 Share on other sites More sharing options...
dodgeitorelse Posted May 2, 2012 Share Posted May 2, 2012 error is in uploader3.php what is in that file on line 2? Quote Link to comment https://forums.phpfreaks.com/topic/261936-some-errors-need-help/#findComment-1342249 Share on other sites More sharing options...
McMaster Posted May 2, 2012 Share Posted May 2, 2012 This normally appears when a variable isn't set properly so you may need to edit the source (well, the line with the error to be precise). Another solution is to suppress warnings. Add this line of PHP code to the source... error_reporting (E_ALL ^ E_NOTICE); Quote Link to comment https://forums.phpfreaks.com/topic/261936-some-errors-need-help/#findComment-1342302 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.