mhtamun mhtamun - 1 month ago 7
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">
<tr>
<td align="right">Book Image</td>
<td>
<label>
<input type="file" name="fileField" id="fileField" />
</label>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<label>
<input type="submit" name="button" id="button" value="Add This Book Now" />
</label>
</td>
</tr>
</table>
</form>


And this the php code

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


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

Answer

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

EDIT

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