How to retrieve contents from a uploaded file - cakephp

I am using cakephp framework. I would like to retrieve the contents of the uploaded file and store it in the database. I want to be able to search the content of the uploaded file.
I was made aware that file_get_contents would work for plain .txt files. But all my documents are .docx and .pdfs. Is there any solution I could use.
I appreciate any help.
Thanks

A quick google search got me this:
http://davidwalsh.name/read-pdf-doc-file-php
It appears you can search those files but it requires some additional packages.

Related

React.js upload file and manipulate the file without sending it to the server?

I have written a front end React.js and want to upload a csv file and then used another program to do the analysis of the csv file and the application needs to remember the path of the file. Is there a way to do so? I browsed on the internet, someone suggested use base64 which I have no idea what it is.
Thanks,
Jo

Zip file format for uploading pre-annotated data in Watson Knowledge Studio

I am trying to figure out how to include a pre-annotated model in Watson Knowledge Studio. I have followed the information found here but it doesn't seem to generalize. As a start I have tried exporting an annotated set from Knowledge Studio to re-upload (using the "Import corpus documents and include ground truth" option). If I re-upload the exported zip as-is this works but if I unzip the folder and then recompress it I get the following error:
A file could not be imported: The imported ZIP file is not in the expected format. Check whether the file was exported from another project. The type system from the same project must be imported first. (You selected 'Import corpus documents and include ground truth').
I have tried using the zip command in Linux (both with and without the -k flag which tries to force to MS-DOS style naming) and also used the compress utility in Windows but I get the same error each time. This is without making any changes to the contents of the folder.
Any help would be greatly appreciated!
Would you please check internal structure of your created ZIP with comparing the original ZIP ? Sometime I got the similar trouble report and found that their created ZIP contains root folder in ZIP structure. WKS expects the same folder structure in the ZIP file.

how to implement file search functionality?

I am working on file search engine functionality.I need your suggestions in designing my application.
I am using elastisearch as framework to implement my functionality.
My primary feature is to enable file search based on file name , file type, size and date of creation. I also need to enable searching based on content of file.
Please suggest what can be best possible file to do the indexing and extract file data.
Also since file can be deleted/updated so i would need to generate the index again in some time interval so how can i monitor any change in directory.
I am using SAMBA as my file storage system.
To have the search option in file content you need to index the file into elasticsearch index.
Look in to the Mapper Attachment plugin and this will help you to index the files and make it searchable.
Step01: install the plugin in to your elasticsearch cluster
Step02: convert the files as byte[] and sent it to elasticsearch index
Step03: Now you can search using the file content using normal queries.
Note: This will work only for text based files like pdf, word (doc,docx) & text files. if the pdf files contains text in images it will not be searchable.

Displaying text files in website

I am developing a website for my dept. My website lists out all project papers in our college. All project papers are .txt files or pdf files or word files.
What is the best way of displaying?
Is using CMS, the efficient way to display the text content?
Uploading the text in DB is a big process. Need to take care of each line.
Is any other way of displaying it?
I dont want to change the format of txt files. It should be displayed as it is in files. Please suggest me.
If it was just text files you could use a CMS as they can keep the text layout, but with Word and PDF files you could just treat it as files.
To start simply, upload the files and have an index page which links to the all the files. To display text and PDF files it should show ok in the browser, but the Word documents would probably be downloaded and viewed on the clients PC (though there are probably plugins if you search)

grails file upload

Hey. I need to upload some files (images/pdf/pp) to my SQLS Database and thereafter, download it again. I'm not sure what is the best solution - store it as bytes, or store it as file (not sure if possible). I need later to databind multiple domain classes together with that file upload.
Any help would be very much apreciated,
JM
saving files in the file system or in the DB is a general question which is asked here several times.
check this: Store images(jpg,gif,png) in filesystem or DB?
I recommend to save the files in the file system and just save the path in the DB.
(if you want to work with google app-engine though you have to save the file as byte array in the DB as saving files in the file system is not possible with google app-engine)
To upload file with grails check this: http://www.grails.org/Controllers+-+File+Uploads

Resources