943,881 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 617
  • PHP RSS
Sep 23rd, 2008
0

sos help

Expand Post »
can anybody please tell me how to insert and retrieve an image stored in a database using php and mysql.the way i m doing now is by storing the file in a server and filename in the db.but the problem with that is while retrieving the image doesnt show up.db entries are all correct..but due to some reason i cant display the file in my webpage.please help...dis is very urgent.i m badly running out of time..thanx in advance
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ayshasherilps is offline Offline
3 posts
since Sep 2008
Sep 23rd, 2008
0

Re: sos help

Last edited by Shanti C; Sep 23rd, 2008 at 9:29 am.
Reputation Points: 137
Solved Threads: 162
Posting Virtuoso
Shanti C is offline Offline
1,641 posts
since Jul 2008
Sep 23rd, 2008
0

Re: sos help

Personally I would not use the second example-saving images into the Database, there is no need.

The filesystem was designed to do this job so why re-invent the wheel? I have yet to come across a scenario where storing images in the database is better than the filesystem.
Reputation Points: 96
Solved Threads: 124
Master Poster
Will Gresham is offline Offline
728 posts
since May 2008
Sep 24th, 2008
0

Re: sos help

thank u so much for ur instant reply.i'll try to qoute my problem here

its like this..
php Syntax (Toggle Plain Text)
  1. //retrieve the filename from db using a select query
  2. $result= mysql_result("SELECT imagename FROM imagetab");
  3. $row=mysql_fetch_array($result);
  4. //then i placed an image object with dynamic source like this
  5. <img src="<?php echo $row[0]; ?>"/>

This is works fair in a localmachine with host as localhost but when deploys it in the hosting space and run as a normal web page i just can't stand it ,i cant see the image.and i am not able to think of reasonable answer.can u help me out of this?
Last edited by peter_budo; Sep 25th, 2008 at 4:33 pm. Reason: Keep It Organized - please use [code] tags
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ayshasherilps is offline Offline
3 posts
since Sep 2008
Sep 24th, 2008
0

Re: sos help

thank u for all who spared a moment to look into my problem.finally i got the answer the problem is with my upload code to upload the image .now i want to sort it out.so again i need help from ur side .how to set file permissions using php
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ayshasherilps is offline Offline
3 posts
since Sep 2008
Sep 24th, 2008
0

Re: sos help

take a look at this fuction:
chmod($pro_imgpath,0777);
php Syntax (Toggle Plain Text)
  1. <?php
  2. // Read and write for owner, nothing for everybody else
  3. chmod("test.txt",0600);
  4.  
  5. // Read and write for owner, read for everybody else
  6. chmod("test.txt",0644);
  7.  
  8. // Everything for owner, read and execute for everybody else
  9. chmod("test.txt",0755);
  10.  
  11. // Everything for owner, read for owner's group
  12. chmod("test.txt",0740);
  13. ?>
And 777- Everybody (i.e. others) has full rights.
Last edited by Shanti C; Sep 24th, 2008 at 5:29 am.
Reputation Points: 137
Solved Threads: 162
Posting Virtuoso
Shanti C is offline Offline
1,641 posts
since Jul 2008
Sep 24th, 2008
0

Re: sos help

Or while uploading it using an FTP client just right click on the folder or file and go to properties. There change the access levels by just typing in the code eg: 777 etc....


ps: do this to the files already on the server
Reputation Points: 10
Solved Threads: 0
Newbie Poster
isaackhazi is offline Offline
22 posts
since Sep 2008
Sep 24th, 2008
0

Re: sos help

Click to Expand / Collapse  Quote originally posted by xan ...
Personally I would not use the second example-saving images into the Database, there is no need.

The filesystem was designed to do this job so why re-invent the wheel? I have yet to come across a scenario where storing images in the database is better than the filesystem.
For one thing, it makes password protection of images much easier to work with and more secure.
Last edited by R0bb0b; Sep 24th, 2008 at 8:31 pm.
Reputation Points: 358
Solved Threads: 89
Posting Shark
R0bb0b is offline Offline
986 posts
since Jun 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: php echo
Next Thread in PHP Forum Timeline: mssql connection problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC