read string in mysql and file like msword (search form) - php

I have a task where I need to upload about 50 msword document in mysql database, it is not a problem. But in the "admin" how can I develop a script where it can find the string in the database and it also can find the string in the file like msword?
For example, I find the word "programming" in the search box, and the word is only in the file "msword"!
So the main problem is how to develop search script that can read data in mysql and in the file like msword?
I am currently using "wordpress" with "contact form 7" to develop upload form.
Can someone give me some suggestions.

You should not only save the Word files as binary files (which are not searchable by MySQL) but should also extract the text within the Word files and save it as a TEXT in the DB. Then you could search with wildcards (i.e. 'WHERE text LIKE "%searchterm%"') and find the words in the files.
Note however that this will become very slow with more and larger files!

Related

How to search files using text inside in Lravel/S3?

I'm using Laravel7 with Aws-S3 as file storage.
The files are PDF only and and I want to add search files feature i.e. If a user search for a text, I want to list all PDF files that has the matching text.
Is this something possible using Laravel alone or using Aws/S3?
I know I can extract all the text of a file on upload and store it in database, and when user search for a text, I can search it from database using %LIKE% query but this will take a huge database space.
I'm looking for something better.

Search inside 70gb of PDF files

I have 70gb PDF files, and I want to search inside them with PHP and some Ajax.
The code must search on all PDF files and extract the data out into table,
For example: 1547AD
When I hit enter the code will search in all PDF files and extract all PDF files that contain "1547AD" inside them.
My problem is: of course putting these data inside MySQL will be better for the server and stronger but imagine extracting all tables in 70GB of PDF files! and these pdf files updated daily, also there is alot of traffic on this page.
My question is: Is it the right way to build this in PHP or I should use another language and/or another method for this kind of heavy data?

How would I make something like puush

So I have my own webserver now and am hosting a website. I have made a basic screenshot to FTP. It copies the link once uploaded and I'm going to be adding randomized folders e.g /push/eqw8/woeqwe.jpg like puush does.
However, this is not my question. I was wondering how I would be able to grab all folders and images from those folders and create a table like this http://puu.sh/oEyfP/783483492c.png or http://puush.me/account in order from upload date. And then it shows in oderder of date uploaded.
I just wanted to do this because I feel more secure and its a fun project doing it.
How would I get about making this.
can you tell me like what I need to do in words?
I'm not good with web development and only good with languages like c# and such.
Learning php and html atm and its pretty basic but I still need time to learn.
At first it depends on your php skills about how much you can think / do in php.
The main thing you need here to order the files / folders by date or manage them at much professional level , you have to use Mysql database and store Files and Folders information inside the database.
For example , let say you have a Image file extension .jpeg then store it's information about :
Extension File size Parent Folder Uploader id / IP Upload Date Unique random key mime type Random name Original name
And there are many other things you need to consider
Files that are being stored by users should be scanned and non executable from the browser.
Store them in random folders with random names so no body can find the way to the file.
You can use javascript/ ajax for uploading multiple files at the same time.
You can make the files non executable by removing their extensions and saving them inside a folder without their original names and save their original names and extensions inside the database along with random string name and the folder name where it was stored so your system can identify the file and you can show your users the file and then on download you can replace the name with original one along with extension.
this is a one of my projects i have created , if you want you can check it out: Buckty
About any other information you need , you can ask me below in comment.

Search text into pdf from database

I'm trying do do a research page that search every pdf from my database that contain the keyword I'm searching.
The problem is I can't have my pdf + the raw text inside my Database (I am extremely short on the space...)
What I am doing right now is when a user search something, On all my pdf, one by one I use a .php I transform the PDF into raw text then search for the keywords... But this is really long before having a result. and I fear when they'll be many user my server won't like it. (I just assume that I've never used server before and I don't really know what is good or bad)
Would it be worth it for me to add space on my server to put all the raw text from my pdf into the database aswell so I can search with Mysql query ? or is there a smarter way to do it i didn't think of ?
(I don't have the PDF inside the database, just the path, so i can't get space on that)

word document {tokens} replacement using PHP

I am trying to read a .doc file and find tokens like {name}, {phone}, {address} etc. now display tokens with text box and allow user to replace by inserting original data. so that .doc file will replace with actual data.how to do this using php? the color, fonts, and style of .doc should not be changed.
thanks....
This will be very tricky if you are using the old style Word documents. The new Word documents are saved in a some sort of Zip archive and therefore are much easier to edit.
You can extract this files and with some knowledge of the contents and Word WSDL you can edit the contents of the file.
Much easier is to make use of the PHPDocX Library. We are using it in a project and works like a charm. Only disadvantage is that it only works with .docx files.

Categories