General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
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  
Old June 20th, 2003, 08:56 AM
alisafwan alisafwan is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: pakistan
Posts: 18 alisafwan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old June 20th, 2003, 09:28 AM
jinx jinx is offline
it's not a tumor
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 22 jinx User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #3  
Old June 20th, 2003, 09:30 AM
jinx jinx is offline
it's not a tumor
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 22 jinx User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Similar Thread

Here's a thread if you didn't notice about blobbing

http://www.devarticles.com/forum/sh...=&threadid=1514

Reply With Quote
  #4  
Old June 20th, 2003, 09:42 AM
alisafwan alisafwan is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: pakistan
Posts: 18 alisafwan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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
Attached Files
File Type: zip untitled.zip (8.3 KB, 248 views)

Reply With Quote
  #5  
Old June 20th, 2003, 10:37 AM
jinx jinx is offline
it's not a tumor
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 22 jinx User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #6  
Old June 20th, 2003, 01:36 PM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
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.

Reply With Quote
  #7  
Old June 21st, 2003, 04:53 AM
thecharking thecharking is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 187 thecharking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to thecharking
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

Reply With Quote
  #8  
Old June 23rd, 2003, 10:30 AM
jinx jinx is offline
it's not a tumor
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 22 jinx User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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:
//make sure picture exists
if ($file_upload != "none") {
     
$filename "/directory/to/put/file/$file_upload_name";
    
     
//copy file onto server
     //copy("source", "destination")     
     
copy($file_upload$filename);
     
unlink($file_upload);



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!

Reply With Quote
  #9  
Old June 23rd, 2003, 10:31 PM
alisafwan alisafwan is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: pakistan
Posts: 18 alisafwan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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 .

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > iMAGE uPLOAD aND dISPLAY


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway