|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
iMAGE uPLOAD aND dISPLAY
hi every body
i am trying to upload image file using the code given on this site with blob datatype and file_uploads 1 1 upload_max_filesize 2m upload_tmp_dir c:\php\uploadtemp but i am getting error" Invalid blobId specified " if using some other code $connection=mysql_connect("localhost","ali","ali") or die ("could't connect to server"); $db=mysql_select_db("CiitPortal",$connection) or die ("Couldn't select database"); $sql2="select image from Tbl_Image"; $sql_result2=mysql_query($sql2,$connection) or die ("Could't found result"); while($row=mysql_fetch_array($sql_result2)){ $ddd=$row['image']; echo $ddd; its not showing me the image can any body help me ali safwan |
|
#2
|
|||
|
|||
|
copy?
It seems to me that just uploading the file to the server in a particular directory, and then just adding the image path to the database makes the most since. Feel free to correct me, but place image "blobs" in the database can't be the best method. Any other thoughts on blobs?
You can also use GD or ImageMagick to resize the image and make a thumbnail on upload, which can be handy for people that like to upload images straight off of their digital camera. |
|
#3
|
|||
|
|||
|
Similar Thread
Here's a thread if you didn't notice about blobbing
http://www.devarticles.com/forum/sh...=&threadid=1514 |
|
#4
|
|||
|
|||
|
thanks for this quick responce
let me send u the whole code which is actully browsing the image and store that in mysql and the output and WHAT is GD u was talking about <? $connection=mysql_connect("localhost","ali","ali") or die ("could't connect to server"); $db=mysql_select_db("CiitPortal",$connection) or die ("Couldn't select database"); $image = $_REQUEST['F1']; $fp = fopen("$image", "a+"); $content = mysql_escape_string(fread($fp, filesize("$image"))); $sql2="INSERT INTO Tbl_Image(image) VALUES( '$content')"; $sql_result2=mysql_query($sql2,$connection) or die ("Could't insert"); $sql2="select image from Tbl_Image"; $sql_result2=mysql_query($sql2,$connection) or die ("Could't found result"); while($row=mysql_fetch_array($sql_result2)){ $ddd=$row['image']; } ?> and $image = $_REQUEST['F1']; is the data i am reciving from html form and output is sir i am waiting for ur reply ali safwan |
|
#5
|
|||
|
|||
|
GD is an image libarary that you can compile into PHP. You can do some pretty cool stuff with it including making images on the fly.
ImageMagick is similar, but it is "a collection of tools and libraries", and then you use the exec() function to send commands to it. I have been using imagemagick to resize images and create a thumbnail for galleries and it works great. http://www.imagemagick.com http://www.devarticles.com/art/1/591 http://www.devarticles.com/art/1/22 http://codewalkers.com/tutorials.php?show=3 |
|
#6
|
|||
|
|||
|
I can't stress enough that there are not too many good reasons to blob your images to the database.
__________________
__________________________________________________ _ Wil Moore III, MCP | Integrations Specialist | Senior Consultant Are You Listed...? | DigitallySmooth Inc. |
|
#7
|
|||
|
|||
|
i hope this isn't dumb
okay I hope my question isn't too elementary, but it is actually something that's been bothering me, and keeping my website from completion, and it was addressed in this post. I want to do exactly as jinx suggested and simply allow users to upload images into a folder. I can't figure out how to do this. I think i don't know enough about forms. At any rate, I have been trying to get this done for so long, and jsut can't seem to figure it out or get the right help, because I don't want to blob my data, and have actually already set my pages up to retrieve the data from pictures dynamically, but had to manually put the pics in. I don't want to do that for every pic. So... any one know?
__________________
hey it's the CHARKING |
|
#8
|
|||
|
|||
|
I will try to explain this as easily as I can - you might want to look for a tutorial for more advanced stuff.
In your form place a file field and give it whatever name you want (I will use "file_upload"). On the page that form submits to (form_parse.php) you will handle all of the processing of the info, and the file uploading. To do the file uploading the code that you need is: PHP Code:
Notice in $filename the form field is $file_upload, but the "_name" will give you the name, not the reference to the file. There is also "_type" which will give you filetype and "_size". Make sure that you have permission to upload to the directory (chmod 777). Then below the file upload, you can add the file name to the database using $filename. Hope that helps you get started! |
|
#9
|
|||
|
|||
|
Thanks
Hi
thanks to all of u i have overcome the file uploading problem by following algo 1. read the file by command of fopen and ab+ 2. store the comtents in data base 3. again retrive them by just select statement 4. store file in a temporary folder 5. display it by <img> tag and the sourse name thanks to all of u if any of u need the code i can send that feel free to contect me . |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > iMAGE uPLOAD aND dISPLAY |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|