i need your help...i want to copy/upload images on server and saving directories in database...Problem is the images are empty =( I'm using:
- WampServer
- Apache Version : 2.2.22
- PHP Version : 5.3.13
- MySQL Version : 5.5.24
Issue is that it's creating the file but is empty.... can it be WampServer fault?
CODE:
<input type="hidden" name="MAX_FILE_SIZE" value="30000">
<input name="image" id="image" multiple="true" type="file" />
<input name="name" id="name" type="text" maxlength="50" value="" placeholder="Enter Image Name" class="text-field"/>
if(isset($_POST['name']) && isset($_POST['image']))
{
$name = $_POST['name'];
$img = $_POST['image'];
$file_url = $img;
$fp = fopen($file_url, 'rb');
$content = fread($fp, filesize($file_url));
$fp = fopen('../Images/UploadedImages/'.$img, 'wb');
$image='../Images/UploadedImages/'.$img;
$result=mysql_query("insert into Images(Name,Directory,Register_Day)
values ('$name','$image',now())");
if (!$result) {
die("Failed to load");}
else{
fputs($fp, $content);
fclose($fp);
}