DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   PHP (http://www.daniweb.com/forums/forum17.html)
-   -   sos help (http://www.daniweb.com/forums/thread147296.html)

ayshasherilps Sep 23rd, 2008 9:14 am
sos help
 
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

Shanti Chepuru Sep 23rd, 2008 9:16 am
Re: sos help
 
provide us with appropriate code...

or check these urls:
http://www.daniweb.com/forums/thread134714.html
http://www.wellho.net/solutions/php-...-retreive.html

Will Gresham Sep 23rd, 2008 10:46 pm
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.

ayshasherilps Sep 24th, 2008 3:17 am
Re: sos help
 
thank u so much for ur instant reply.i'll try to qoute my problem here

its like this..
//retrieve the filename from db using a select query
$result= mysql_result("SELECT imagename  FROM imagetab");
$row=mysql_fetch_array($result);
//then i placed an image object with dynamic source like this
<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?

ayshasherilps Sep 24th, 2008 4:45 am
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

Shanti Chepuru Sep 24th, 2008 5:26 am
Re: sos help
 
take a look at this fuction:
chmod($pro_imgpath,0777);
<?php
// Read and write for owner, nothing for everybody else
chmod("test.txt",0600);

// Read and write for owner, read for everybody else
chmod("test.txt",0644);

// Everything for owner, read and execute for everybody else
chmod("test.txt",0755);

// Everything for owner, read for owner's group
chmod("test.txt",0740);
?>
And 777- Everybody (i.e. others) has full rights.

isaackhazi Sep 24th, 2008 8:36 am
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

R0bb0b Sep 24th, 2008 8:11 pm
Re: sos help
 
Quote:

Originally Posted by xan (Post 697617)
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.


All times are GMT -4. The time now is 7:22 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC