BarneyJoe Posted September 15, 2007 Share Posted September 15, 2007 Hope someone can help with this - it's some code I've used before, and had working fine, but am having problems with another site. In the site it works for, I have a file input : <tr> <td class="labelcell">Image File Name </td> <td class="fieldcell"><input type="file" name="Image"></td> </tr> And then in a validate.php page, the upload code : if ( is_uploaded_file($_FILES['Image']['tmp_name']) ) { $destpath = '../Photos/' . basename($_FILES['Image']['name']); if (!move_uploaded_file($_FILES['Image']['tmp_name'], $destpath) ) { echo 'Error moving file ' . $_FILES['Image']['tmp_name'] . ' to ' . $destpath; } } Which, as I say, works fine. However, in a new site I'm doing, I have the input as : <tr> <td class="labelcell">Image File Name </td> <td class="fieldcell"><input type="file" name="ImageLarge"></td> </tr > And the upload code in my validation file : if ( is_uploaded_file($_FILES['ImageLarge']['tmp_name']) ) { $destpath = '../jewelleryimages/' . basename($_FILES['ImageLarge']['name']); if (!move_uploaded_file($_FILES['ImageLarge']['tmp_name'], $destpath) ) { echo 'Error moving file ' . $_FILES['ImageLarge']['tmp_name'] . ' to ' . $destpath; } } ie, ie matching the input field name, 'ImageLarge', and changing the destination path (double checked) to '../jewelleryimages/' However, when I try to use it, I'm getting the error : Warning: move_uploaded_file(../jewelleryimages/fashion.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/iqzwlvrk/public_html/admin/validate3.php on line 243 Where line 243 is if (!move_uploaded_file($_FILES['ImageLarge']['tmp_name'], $destpath) ) { Any idea what I'm missing here? Many thanks. Quote Link to comment https://forums.phpfreaks.com/topic/69455-solved-upload-file-script/ Share on other sites More sharing options...
AdRock Posted September 15, 2007 Share Posted September 15, 2007 Has the jewelleryimages folder on the server had it's permissions set to allow you to upload to it Quote Link to comment https://forums.phpfreaks.com/topic/69455-solved-upload-file-script/#findComment-348985 Share on other sites More sharing options...
BarneyJoe Posted September 15, 2007 Author Share Posted September 15, 2007 That's what I'm trying to figure out - can't remember where I'd have set those permissions... Quote Link to comment https://forums.phpfreaks.com/topic/69455-solved-upload-file-script/#findComment-348987 Share on other sites More sharing options...
BarneyJoe Posted September 15, 2007 Author Share Posted September 15, 2007 Think I've found it - comparing the permissions in the respective control panels, the original is set to 0777, while the new one is still showing as 0755 - changed that, and it's fine. Think I had a mental block about permissions to access the database. Cheers. Quote Link to comment https://forums.phpfreaks.com/topic/69455-solved-upload-file-script/#findComment-348991 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.