mhtamun mhtamun - 3 months ago 22
PHP Question

PHP: File upload move_uploaded_file() method not working for IIS7

When I was using XAMPP server and MySQL database that time it was working, but I have to use MSSQL database IIS7 server where its not working. See This is the html form:

<form action="bookentry.php" enctype="multipart/form-data" name="myForm" id="myform" method="post">
<table width="90%" border="0" cellspacing="0" cellpadding="6">
<td align="right">Book Image</td>
<input type="file" name="fileField" id="fileField" />
<input type="submit" name="button" id="button" value="Add This Book Now" />

And this the php code

$newname = "$bid.jpg";
move_uploaded_file( $_FILES['fileField']['tmp_name'], "../inventory_images/$newname");
header("location: inventory.php");

I don't understand the problem and where it occurs!


Check whether you've write permission to the folder in which you're trying to move that file.(inventory_images).


as per your comment to check permissions in windows OS:

right click that folder go to properties and then go to security tab

From that you can also give the permission by simply checking the checkbox and then clicking on apply button.

Here is screen shot to help:

enter image description here