php script to upload files

by hood
7 replies
I am working on a site that needs the end user to upload a csv file and then parse this file and add it to a mysql db

does anyone know where I can find a php script like this

thanks
Yehudah
#files #php #script #upload
  • Profile picture of the author webpeon
    do you want to add the information inside the csv file to your database or just add the file itself?

    The initial option can get quite complicated.

    If you are just wanting to include the file itself in the database your best option would be to add all uploaded csv files to a separate folder and just add the url of that file to your database.

    and I just realised you are looking for PHP code to do this which I probably cant help you with but the above would still apply
    Signature
    Web 2 Mobile
    The Future of The Web
    {{ DiscussionBoard.errors[6673131].message }}
  • Profile picture of the author briangriffin
    There are plenty of sample scripts/tutorials that cover each of the 3 components you described, but the result you want will definitely require a custom script. The reason being only a custom script will know what format the data in the CSV file will be in so it can parse it correctly and then insert it into a MySQL table in the format that is expecting.
    {{ DiscussionBoard.errors[6673143].message }}
  • Profile picture of the author Brandon Tanner
    To upload...

    PHP File Upload

    You say you want to "parse" the file after that, but that can mean 100 different things, so you'll have to be more specific about what you mean by "parse".
    Signature

    {{ DiscussionBoard.errors[6673155].message }}
  • Profile picture of the author jaasmit
    Getting free scripts is not a good practice.
    You should hire someone or try to solve your problem on your own.
    That would be better.
    {{ DiscussionBoard.errors[6674738].message }}
  • Profile picture of the author TopicSpan
    Parsing a CSV is, in itself, not a complicated exercise in PHP. Building SQL insert statements, too, isn't complicated. Receiving a file from an HTTP POST isn't too complicated either.

    But tying them all together? That's the art

    I would strongly suggest you follow jaasmit's advice and either hire an experienced developer or do a lot of reading and messing around to do it yourself. Don't forget that communities like Stackoverflow will often help you much faster with specific questions around PHP development.
    Signature
    Don't lose users!
    Grab our full-page UltraCache system that instantly speeds up any PHP website!
    {{ DiscussionBoard.errors[6674861].message }}
  • Profile picture of the author 26medias
    For the upload, I recommend Uploadify (can't post link so google it).
    In the upload file, parse the CSV using any CSV class you'll find on phpclasses (again, can't link, google it).
    As for inserting in a database, well... it's just an insert statement.
    if you can't do that, then you'll need to learn PHP first, or outsource.
    {{ DiscussionBoard.errors[6676041].message }}
  • Profile picture of the author xxmm94
    use your own script is better than the free crap
    learn php and mysql it's not that hard
    {{ DiscussionBoard.errors[6676231].message }}

Trending Topics