Ender22 Posted March 6, 2007 Share Posted March 6, 2007 Hello! Thanks for taking the time to read my post. Im working on a project with PHP that allows users to upload pictures to my server and then reference them. After going through some uploading tutorials I have the uploading part working Except! I cant upload folders to my remote root folder. I need to allow the users to upload somewhere inside the root folder so they can reference the pictures in code after. Just to clarify the uploading works perfectly if I put the uploads folder anywhere on my computer except the sites remote root folder (or anywhere inside the root folder) I also beleive I am giving the folder all of the proper permissions because I am giving the uploads folder in my root directory (the one that doesnt work) the same permissions as the one outside the root (the one that works) Here is a specific example with my code of the problem. My html file containing the form: <form enctype="multipart/form-data" action="uploader.php" method="POST"> <div align="center"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Please choose a file to upload: <input name="uploadedfile" type="file" /> <input name="submit" type="submit" value="Upload File" /> <br /> </div> </form> which is directory to uploader.php page with code: <?php // $target_path = "/uploads/"; // this path doesnt work // $target_path = "C:/Inetpub/wwwroot/GetPHPToWork/uploads/" // this path also doesnt work $target_path = "C:/Inetpub/uploads/"; // this path or any other path with permissions on my computer works! $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo " The file has been uploaded "; } else { echo "There was an error uploading the file, please try again!"; } ?> by the way my remote directory folder is: "C:\Inetpub\wwwroot\GetPHPToWork\" when my target path is: $target_path = "/uploads/"; $target_path = "C:/Inetpub/wwwroot/GetPHPToWork/uploads/" ] I get my php echo "There was an error uploading the file, please try again!"; but if the path is $target_path = "C:/Inetpub/uploads/" it works perfectly. here is my upload settings in php.ini incase you want to see them: ;;;;;;;;;;;;;;;; ; File Uploads ; ;;;;;;;;;;;;;;;; ; Whether to allow HTTP file uploads. file_uploads = On ; Temporary directory for HTTP uploaded files (will use system default if not ; specified). upload_tmp_dir = C:/PHP/uploadtemp/ ; Maximum allowed size for uploaded files. upload_max_filesize = 20M Im not sure why I cant upload to the folder I want... ??? any help is greatly appreciated! Thanks! Quote Link to comment 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.