Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Querying links stored in database

Status
Not open for further replies.

kjspear

Programmer
Feb 13, 2002
173
US

I set up a page to store links in a database rather than storing the image. This way I can
save space on the database since the limit is 4GB.

This is what I get as a record in the myimage table;

ID Imagefilepath
2 C:pHPuploadtempphp36.tmp


Whatdoes C:pHPuploadtempphph36.tmp mean?

Can this be read? Is this a code to tell php/mysql that the file is located in

$uploaddir = 'c:/mysql/data/mylogin/upimages/'?

What I'm trying to do here is have php read the link in the $uploaddir string and
load the picture on a webpage.

Uploading the image file to the directory stated above works fine.


Any assistance will be helpful.

Thanks
Kyle
 
I agree with sleipnir... but can probably offer you a hint to decode it...

\'s are escape characters... if you only have one they disappear... so that likely means something like

c:\php\upload\temp\php36.tmp

which would imply to me you uploaded a file, but never saved it out to the file system.

-Rob
 
skiflyer:
<sarcasm>
Just so you won't feel all alone while hypothesizing...
</sarcasm>

kjspear:
Judging by the filename you're storing, it may also be possible that instead of storing $_FILES['userfile']['name'] in the database, you're storing $_FILES['userfile']['tmp_name'].

Want the best answers? Ask the best questions: TANSTAAFL!!
 
O.K., perhaps I wasn't really clear on what I am trying to do, sorry.

Basically, I would like to know how to store a link as described above in a database and retrieve it so that it will point to a directory, which holds the image files. This way I will be able to display the results from the link to a web page.

Any help would be appreciated.

Thanks
Kyle
 
Let's say, for the sake of argument, that the document root of your web site is D:\sites\mysite, and that you're storing your images in one directory, &quot;D:\sites\mysite\images&quot;.

In the database, I'd just store the filename.

In my web script, I would fetch the filename from the database, prepend the necessary path information (in this case, &quot;/images/&quot;) to the filename, then output that filename as the value of a &quot;SRC&quot; attribute of an &quot;<IMG>&quot; tag.


If instead of storing all the images in one directory, suppose you have three directories, d:\mysite\images\aircraft, d:\mysite\images\boats, and d:\mysite\images\landcraft.

I would store the filename and subdirectory name in the database. For example, to store the filename of a motorcycle, I'd store &quot;landcraft/mycyle.jpg&quot; in the database.

Then in my web script, I would fetch the filename from the database, prepend the necessary path information (in this case, &quot;/images/&quot;) to the filename, then output that filename as the value of a &quot;SRC&quot; attribute of an &quot;<IMG>&quot; tag.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top