Jump to content

upload images


bhavin_85

Recommended Posts

hey guys

 

ive written the following script to upload images into my database, when i run the script its not uploading the actual image, instead its uploading text :

The image “http://localhost/phpmyadmin/transformation_wrapper.php?db=pbl&table=images&token=7702270187dddc70583616014189dfc7&pos=

0&session_max_rows=30&disp_direction=horizontal&repeat_cells=100&dontlimitchars=0&primary_key=+%60images%60.%60image_id%

60+%3D+1&sql_query=SELECT+%2A+FROM+%60images%60&goto=&transform_key=image” cannot be displayed, because it contains errors.

 

any ideas why its doing this?  ???

 

update_promo.php

<form method="post" enctype="multipart/form-data" action="upload_image.php">
Image ID: <input type="text" name="image_id" value="<? echo $image_id ?>"></br></br>
Image to Upload: <input type="file" name="image"></br></br>
Image Description: <input type="text" name="description"></br></br>
<input type="submit" name="submit" value="submit">
</form>

 

the action page is upload_image.php

<?php
session_start();
if ( empty($_SESSION['username'])){
header("location:../default.php");
exit;
}

$image_id=$_POST['image_id']; 


include'../config.php';
$sql = "UPDATE images SET image_id = '".$_POST['image_id']."', image = '".$_FILES['image']."',description = '".$_POST['description']."' WHERE image_id = '$image_id'";
mysql_query($sql) or die ("Couldnt execute $sql: " . mysql_error()); 
header("location:promo.php");
?>

Link to comment
https://forums.phpfreaks.com/topic/43395-upload-images/
Share on other sites

yep its a blob field

 

the reason im uploading to the database is that i have to run a query which checks through a table for a certain id, counts them then dependant on that ID it disaplys a picture...is there another way that i can do this without uploading to a databsae?

 

Link to comment
https://forums.phpfreaks.com/topic/43395-upload-images/#findComment-211108
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.