Lost Password?

Go Back   CodeCall Programming Forum > Web Development Forum > Database & Database Programming

Database & Database Programming MySQL, Oracle, SQL, PL/SQL, ABAP, Smart Forms, and other databases and languages. A database is an organized body of related information used in many websites (including CC).

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-13-2008, 10:37 AM
zerostar's Avatar   
zerostar zerostar is offline
Newbie
 
Join Date: Jan 2008
Posts: 12
Rep Power: 0
zerostar is on a distinguished road
Wink file system based references

Heya peeps

kind of a noobDev here so please bear with me.

I'm working on a system where we have many files in various directories and sub directories that we want to make available to users as lists and links to download the files. (WAMP/Symfony mixture on the build, btw)

I have setup some tables in our DB and I was wondering a couple of things:
  1. How do I reference the files location on the drive from within the database? I am guessing that I should copy the physical location (i.e. C:\wamp\docs\marketing\peeps\ etc.) to a LONGTEXT or LONGVHARCHAR column, but I want to make sure I format it correctly
  2. There are many various document types and many different file sizes involved (ranging from around 100k to 200mb). What is the best way to set these as downloadable links? Do I have to include a column for mime_type and/or file_size? If so, what are the attributes for those columns and can those attributes be automatically pulled from the files themselves, or do I have to manually enter that data in the database?
  3. My idea is to have all the docs referenced in one table, with a foreign-key pointing to a media_category table which references the category (or path attributes i.e. c:\wamp\docs\marketing\peeps\old versions would be input as peeps, old versions into the media_category table. The Marketing tag would come from a separate foreign-key referencing the dept_name table).Is this the most efficient way to do this, or am I prepping overKill?
  4. If I do enter all of the paths manually into the 'location' column, do I need to input %20's for spaces in the DIR names, or will that be parsed correctly through the front end?

Any other thoughts on setting this type of system up would be greatly appreciated as well. Thanks so much for your time!
__________________
::
[ z ]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 03-18-2008, 04:26 PM
zerostar's Avatar   
zerostar zerostar is offline
Newbie
 
Join Date: Jan 2008
Posts: 12
Rep Power: 0
zerostar is on a distinguished road
Default Re: file system based references

bumpsies?
__________________
::
[ z ]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-26-2008, 11:51 PM
orjan orjan is offline
Learning Programmer
 
Join Date: Sep 2007
Posts: 44
Rep Power: 4
orjan will become famous soon enough
Default Re: file system based references

The most important thing is to escape the backslashes when you store the path to the database.

about substituting paths, you should url-encode your paths and filenames
but then there is the question if it's better to encode it to the db or when presenting it to the user. it depends on how you will treat the filepaths later in your code.

i hope for your security reasons that you don't think about doing like this:

"download.php?file=c:\wamp\docs\marketing\peeps\ol d\file.mp3"

but instead "download.php?fileid=23" where 23 is the id in your database reffering to the file, as in the first case, someone could rewrite the address to "download.php?file=c:\my\secret\files\passwords.tx t" and get whatever file they want from the server.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-27-2008, 10:19 AM
zerostar's Avatar   
zerostar zerostar is offline
Newbie
 
Join Date: Jan 2008
Posts: 12
Rep Power: 0
zerostar is on a distinguished road
Default Re: file system based references

thank you for the tip Orjan

I will employ your ideas into my process for sure.
__________________
::
[ z ]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Doing final year project based upon an intrusion detection system (IDS) - Need Help! naveed.pasha Programming Theory 6 07-07-2008 06:15 PM
Visual Studio 2008: C# Reading Files Jordan CSharp Tutorials 8 06-20-2008 10:54 AM
File Manager Jaan Community Projects 40 02-27-2008 03:45 PM
Windows XP Tricks & Tips!!!!..new ones. pranky Tutorials, Classes and Code 7 02-01-2007 10:58 PM


All times are GMT -5. The time now is 08:08 PM.

Contest Stats

Xav ........ 164.00000
dargueta ........ 128.00000
John ........ 127.00000
gaylo565 ........ 18.00000
XaNaX ........ 15.00000
Johnnyboy ........ 3.00000
navghost ........ 1.00000

Contest Rules

Ads