bhavin_85 Posted March 19, 2007 Share Posted March 19, 2007 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 More sharing options...
bhavin_85 Posted March 20, 2007 Author Share Posted March 20, 2007 Can any1 help....this is the last bit on my site and i need to present it tommorow ??? Link to comment https://forums.phpfreaks.com/topic/43395-upload-images/#findComment-211021 Share on other sites More sharing options...
JasonLewis Posted March 20, 2007 Share Posted March 20, 2007 is the image field a blob filed. and i believe you need ['tmp_name'] or something on the end of the ['image'] not sure, i dont usually upload to database. Link to comment https://forums.phpfreaks.com/topic/43395-upload-images/#findComment-211039 Share on other sites More sharing options...
bhavin_85 Posted March 20, 2007 Author Share Posted March 20, 2007 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.