473,387 Members | 1,624 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

needing a script to dump pdf files into a MySQL database

I have a MySQL database and would like to upload multiple pdf files at once and store the information into the db. Here is the db I created:
Expand|Select|Wrap|Line Numbers
  1. 1.    CREATE TABLE `file` ( 
  2. 2.        `id`        Int Unsigned Not Null Auto_Increment, 
  3. 3.        `name`      VarChar(255) Not Null Default 'Untitled.txt', 
  4. 4.        `mime`      VarChar(50) Not Null Default 'text/plain', 
  5. 5.        `size`      BigInt Unsigned Not Null Default 0, 
  6. 6.        `data`      MediumBlob Not Null, 
  7. 7.        `created`   DateTime Not Null, 
  8. 8.        PRIMARY KEY (`id`) 
  9. 9.    ) 
Is there a script that I can run that will accomplish this? I have created a webpage but can only upload one at a time and would just like to do a full dump of 3000 files at once creating a record for each in the db.
Thanks
Apr 22 '10 #1
1 1732
Atli
5,058 Expert 4TB
Hey.

A browser can not do this for you. It only allows single point-and-click uploads. (Meaning: the user has to select each file manually.) This is for obvious security reasons.

I see three ways to accomplish what you are trying to do:
  1. Upload all the files manually to the server, using FTP or something like that. Then create a server-side script that scans the upload directory and inserts each file it finds.
  2. Create a client-side application (Java, C#, C++, whatever) that acts as a browser, sending each file to the web-application via a HTTP request. - This is of course a lot of work if you only intend to use it once, but it may be a good idea if you intend to do this a lot.
  3. Set the "client" computer (read: your computer) up as a FTP or SSH server, and create a server side script that connects to your computer, downloads the files, and inserts them into the database.

Any way you choose, you will have to custom make the script to fit your specific situation. There is not ready-made script that you can use. (None that I know of, at least. Perhaps on Google, who knows.)
Apr 23 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Sticks | last post by:
ok... im not quite sure how to describe my problem. i have a php script that runs through my entire php site and writes the resulting output to html files. this is necessary as the nature of the...
3
by: somaBoy MX | last post by:
I'm looking for a script that I can run periodically (from crontab) that creates a dump from a mysql database, stores it in a folder on the server and maybe sends me a copy via email. I think I...
2
by: jet | last post by:
Hi, Maybe this is an easy task, but I'm having a really hard time figuring out how to do this. I'm a complete newbie to SQL Server. I have a database dump file from MySQL that's in .sql...
6
by: Eric Robinson | last post by:
Our database just slowed down radically. Certain queries drive CPU utilization through the roof. This happened once before, and the technican simply dumped the data to disk and then played it back...
2
by: mike vidal | last post by:
Is it possible to restore a mysql server if all that you have is the data files. This database uses innodb tables.
1
by: Brian Sadler | last post by:
Does anyone know where I can find information on how to setup my shell in unix/linux to allow me to restore a database from an sql dump... Example... I have a database on 83200.mysql.com ...
5
by: news | last post by:
I have a new situation I'm facing and could use a suggestion or two, as I don't seem to be able to think in the abstract very well. We have a local server which holds all of our image files. We...
4
by: Robert Blackwell | last post by:
A while ago I had some help from here to make a batch file that would dump my db. Everything was working just fine until 2 days ago and I just found out. I checked my backup folder and found...
6
by: rhaazy | last post by:
I have to create a script to install a database, and one of the tables has about 200 rows of static data... I dont want to have to manually type in 200 insert statements, so is there a better way...
6
by: ssharpjr | last post by:
Hi Guys, I'm new to Python (mostly) and I'm wanting to use it for a new project I'm faced with. I have a machine (PLC) that is dumping its test results into a fixed- length text file. I need...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.