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
https://forums.phpfreaks.com/topic/144689-file-upload/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.