Yohan Posted July 24, 2006 Share Posted July 24, 2006 I have setup PHP on my Windows 2000 Box and tried a simple Form upload using the following html code<form action="Backend.php" method="post" enctype="multipart/form-data"> <input name="Upload_File" type="file"> <input type="submit" name="Submit" value="Submit"></form>The HTML files calls Backend.php file and here is what it does,$uploaddir = 'c:\php\uploadtemp\IR';$uploadfile = $uploaddir . basename($_FILES['Upload_File']['name']);move_uploaded_file($_FILES['Upload_File']['tmp_name'], $uploaddir); // Move the Uploaded file to the Incomming FolderBasically, take the incomming file from the form upload and move it to a particular location.For some reason this does not work.I dont know if Im missing anything from the php.ini file.Can someone pls help me out ?CheersYohan Quote Link to comment https://forums.phpfreaks.com/topic/15459-file-upload-error-6-using-php-on-windows-2000/ Share on other sites More sharing options...
manichean Posted July 24, 2006 Share Posted July 24, 2006 Hello Yohan,Two mistakes as far as I can see[code]$uploaddir = 'c:\php\uploadtemp\IR'; //Needs to end with a trailing slash[/code]should be[code]$uploaddir = "c:\\php\\uploadtemp\\IR\\"; [/code][code]$uploadfile = $uploaddir . basename($_FILES['Upload_File']['name']);move_uploaded_file($_FILES['Upload_File']['tmp_name'], $uploaddir); // Move the Uploaded file to the Incomming Folder//you are specifying the uploaddir instead of the uploadfile[/code]should be[code]$uploadfile = $uploaddir . basename($_FILES['Upload_File']['name']);move_uploaded_file($_FILES['Upload_File']['tmp_name'], $uploadfile); // Move the Uploaded file to the Incomming Folder[/code] Quote Link to comment https://forums.phpfreaks.com/topic/15459-file-upload-error-6-using-php-on-windows-2000/#findComment-62703 Share on other sites More sharing options...
Yohan Posted July 25, 2006 Author Share Posted July 25, 2006 Thanks man !I tried this but still the file size thats been uploaded is 0.So basically there is nothing that get uploaded.How strange, isnt this supposed to be a very simple process ?Please advice as I am stuck and have no clue as to what may be wrong.CheersYohan Quote Link to comment https://forums.phpfreaks.com/topic/15459-file-upload-error-6-using-php-on-windows-2000/#findComment-63242 Share on other sites More sharing options...
manichean Posted July 25, 2006 Share Posted July 25, 2006 Have you checked the size of the file you are trying to upload, and then compare it to the one that is uploaded ? Maybe you are uploading a 0 byte file.Try this, create a file called 1.txt on your desktop[b]1.txt[/b][code]Testing if the upload function is working[/code]Put these files in ur web directory [b]form.php[/b][code]<html><body><form action="post.php" method="post" enctype="multipart/form-data"> <input name="Upload_File" type="file"> <input type="submit" name="Submit" value="Submit"></form></body></html>[/code][b]post.php[/b][code]<?php$uploaddir = "";$uploadfile = $uploaddir . basename($_FILES['Upload_File']['name']);move_uploaded_file($_FILES['Upload_File']['tmp_name'], $uploadfile); ?>[/code]This should upload the file 1.txt from your desktop, to the path of your webserver that contains the form.php and post.php page.Let me know if you are successfull. If not tell me the type of webserver you are running, the file type you are trying to upload and are you running php 4 >= 4.0.3 or php 5 Quote Link to comment https://forums.phpfreaks.com/topic/15459-file-upload-error-6-using-php-on-windows-2000/#findComment-63267 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.