Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9

Thread: upload file

  1. #1
    New Coder
    Join Date
    Feb 2006
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question upload file

    is there anyone who can assist me in doing uploading of file to a table in database? i've tried, but it still doesn't work.

    i'm creating the upload as a standalone form, and the file will be identified with the event code that was being assigned to the event. before doing the upload, i will need to create the event with the details first.

    who can help me with the upload function programming??
    [=cHeRyL=]

  • #2
    New Coder
    Join Date
    Jun 2006
    Location
    USA
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Lol, we meet again!

    This all depends on what type of files you're expecting to be uploaded (i.e.: text and images would be very different with regard to the database). I highly recommend you become very familiar with the MySQL documentation. In comparison with the greatness of the PHP and Python documentation, MySQL's manual can be a bit difficult to sort through. So, try looking up data types. The string types may be of the most help to you.
    "Some people, when confronted with a problem, think, 'I know, I'll use regular expressions.' Now they have two problems."
    --Jamie Zawinski

  • #3
    New Coder
    Join Date
    Feb 2006
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Curtis D
    Lol, we meet again!

    This all depends on what type of files you're expecting to be uploaded (i.e.: text and images would be very different with regard to the database). I highly recommend you become very familiar with the MySQL documentation. In comparison with the greatness of the PHP and Python documentation, MySQL's manual can be a bit difficult to sort through. So, try looking up data types. The string types may be of the most help to you.

    hi curtis!

    well generally, the type of files mostly uploaded will be pdf files. i have sourced out some examples from the net, but it won't work. mediumblob data type can store files more than 16megabytes, right?

    i would very much like to store the file into the database and retrieve it for downloading purposes.

    basically, what necessary or needed fields the table might need? note that i have a table that stores the event details and would need to match the flier to the eventcode assigned. can the flier be matched to the eventcode if it's included in the addevent form but it post the details and flier to different table? but the tricky thing is, the eventcode is generated when the event is added. how then would the flier table know what is the event is just being added into the table?

    i might be confusing myself. i need some enlightenment. =)

    thanks.
    [=cHeRyL=]

  • #4
    New Coder
    Join Date
    Jun 2006
    Location
    USA
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Lol, you may have confused me!

    Okay, now is the time that you thank your database for being a relational database. We don't actually need to upload the PDF binary data into the database, the overhead would end up being too large. In stead, you upload the PDF into some upload directory of your choosing. What you do is make a table in your dB for the PDFs. You just include the URL to where each PDF will be located, and also associate the event code in that table. So, when you create the event code, you assign in the PDF table, and all other tables. By creating/adding the event codes at the same time, you can just make a query that checks entries where the event code is the same across tables.

    I can't tell whether I'm making sense, or I'm just tired. In any case, getting this down requires some mastering of concepts with which you may or may not be too familiar.
    "Some people, when confronted with a problem, think, 'I know, I'll use regular expressions.' Now they have two problems."
    --Jamie Zawinski

  • #5
    New Coder
    Join Date
    Feb 2006
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Curtis D
    Lol, you may have confused me!

    Okay, now is the time that you thank your database for being a relational database. We don't actually need to upload the PDF binary data into the database, the overhead would end up being too large. In stead, you upload the PDF into some upload directory of your choosing. What you do is make a table in your dB for the PDFs. You just include the URL to where each PDF will be located, and also associate the event code in that table. So, when you create the event code, you assign in the PDF table, and all other tables. By creating/adding the event codes at the same time, you can just make a query that checks entries where the event code is the same across tables.

    I can't tell whether I'm making sense, or I'm just tired. In any case, getting this down requires some mastering of concepts with which you may or may not be too familiar.
    ho... i think will have to slowly analyse this. i'll get back to you when i'm done thinking.
    [=cHeRyL=]

  • #6
    New Coder
    Join Date
    Feb 2006
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Curtis D
    Lol, you may have confused me!

    Okay, now is the time that you thank your database for being a relational database. We don't actually need to upload the PDF binary data into the database, the overhead would end up being too large. In stead, you upload the PDF into some upload directory of your choosing. What you do is make a table in your dB for the PDFs. You just include the URL to where each PDF will be located, and also associate the event code in that table. So, when you create the event code, you assign in the PDF table, and all other tables. By creating/adding the event codes at the same time, you can just make a query that checks entries where the event code is the same across tables.

    I can't tell whether I'm making sense, or I'm just tired. In any case, getting this down requires some mastering of concepts with which you may or may not be too familiar.
    let me get this right.

    are u trying to say that let the file be uploaded to a directory (folder). but in the PDF table in the database, i will store the location to where the file is being stored?

    and how shall i do that? include the upload into the existing form and code the upload to a directory, retaining the capturing of event details into the event table. then have a seperate table to store the location link of the files, matching it with the eventcode assigned eventually?
    [=cHeRyL=]

  • #7
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    If database space isn't an issue (as in it's your own server) then storing files in the database often makes a lot more sense, as you don't have to worry about db->fs links being broken.

    A lot of cheaper hosting will impose size restrictions on DBs a lot lower than the file-space you get, so in such a case storing files as files makes more sense.

  • #8
    New Coder
    Join Date
    Feb 2006
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by GJay
    If database space isn't an issue (as in it's your own server) then storing files in the database often makes a lot more sense, as you don't have to worry about db->fs links being broken.

    A lot of cheaper hosting will impose size restrictions on DBs a lot lower than the file-space you get, so in such a case storing files as files makes more sense.
    so which method is recommended?? store the file in db and retrieve it? or store in file and link it to URL??? the link to download or open the file would need to work very well with minimal error
    [=cHeRyL=]

  • #9
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    As I said, it depends on your environment.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •