Jump to content

File Upload


alejandrard

Recommended Posts

I been working for hours on this I don't understand what is going on, I am trying to upload a file I'm using local host and I have XAMPP, I have my form:

 

<form action="" method="post" id="add_book" enctype="multipart/form-data">

<tr>

  <td valign="top"><strong>Graphic Upload:</strong></td>

    <td valign="top"><input type="file" name="graphic_upload" size="30" /><br /><br /></td>

</tr>

<tr>

  <td valign="top" align="right"><input type="submit" name="submit" value="submit" /><br /><br /></td>

</tr>

</table>

</form>

 

 

I have my upload code:

 

$uploaddir = ROOTDIRECTORY.'book_images/';

 

if ( is_uploaded_file($_FILES[graphic_upload] [tmp_name]))

  {

//this is not working in my local host

    if(move_uploaded_file($_FILES[graphic_upload][tmp_name], $uploaddir.$_FILES[graphic_upload][name]))

{echo "File Upload";}

  else

{echo "File Not Upload";}

  }

 

To debug I have print the  $_FILES variable and everything seems to be there. When it goes through the code is_uploaded_file() function returns true but the move_uploaded_file() returns the following error

 

Warning: move_uploaded_file(/publishing/book_images/stop_bothering.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in C:\xampp\htdocs\publishing\admin_addbook.php on line 82

 

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\xampp\tmp\php23F.tmp' to '/publishing/book_images/stop_bothering.jpg' in C:\xampp\htdocs\publishing\admin_addbook.php on line 82

 

I have check  the directory path for hours  ???,

 

can some one help me?

 

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.