Jump to content

[SOLVED] Upload file script


BarneyJoe

Recommended Posts

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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.