In my application,user can upload some doc files to the server,and I want user who do not install ms office can read these documents,so I want to convert the .doc to html and then save the html(binary stream) to oracle db.
I wonder if there is a best pratice to implement this?
Someone tell me to use the com object provoided by the office assembly,it seems that it will transfer the .doc file to a .html file,so I have to save the .html file to db and delete the temp .html file,I want to know if I can save it in db directly?
You might need to give everyone a bit more information...
I assume you're using a server side technology? Which one?
What database are you using?
The chances are if the COM object is writing it to a file, you will - like you say, just need to copy that into the DB, and delete the temp file.
IMHO - There should be nothing wrong with saving to temp file and outputting that to DB (if you could save to memory that would be even better!)
Related
I am having hard time figuring out how to get the file InputStream from file upload Post request to server, before it gets completely loaded into memory.
This is not problematic for smaller files, but I am worried what happens after trying to upload a larger file (1 or more GB). I found a possible solution with using HttpContext.Request.GetBufferlessInputStream(true), but this stream includes the whole request not just the uploading file and if I use it to upload a file for example into the Azure Blob Storage or anywhere else I end up with the corrupted file. I also lose all the information about the file (file name, size, etc.).
Is there any convenient way of uploading a large file to server without filling its memory? I would like to get the stream and then use it to upload a file anywhere in chunks.
Thank you.
I used DevExpress UploadControl for a similar task. It supports large file upload by chunks. A temporary file is saved on a server hard drive and you can get it using FileSteam without full loading in server memory. It also supports direct upload to Azure, Amazon and Dropbox.
The same is true for their MVC Upload control.
I'm creating an app where users need to work with large databases. Rather than having the users download the data and populate an SQLite database on the client (which would take a long time), I'm hoping I can use downloadable, pre-populated databases.
I found cordova-sqlite-ext, which allows working with pre-populated databases, but SQLite files must be located in the www folder for this to work. Is it actually possible to download files to this folder in Ionic/Cordova (on non-rooted devices)?
It's always good practise to store your files in app's directory. Check this comment of mine and see if it helps you:
https://github.com/driftyco/ionic-native/issues/881#issuecomment-270832521
I had a requirement of downloading a zip file(with sqlite file in it), unzip the file, store the file in app's directory and query the DB. I was able to achieve it using plugins and works quite well.
i'm asp.net beginner and currently working in "upload download file" project with asp.net and vb.net as code behind language (like skydrive's web).
what i'm want ask is about upload file in server, must we store path file, size, accessed or created date into database? as we know we can use directory listing in system.io.
Thanks for your help.
You definetly want to store the path of the file. You want a way to find the file ;) Maybe later you will have multiple servers, replication or other fancy things.
For the rest, it depends a bit on the type of website. If it's going to get high traffic then store it in the database, this will limit the number of IO call (very slow). Also, it'll be a lot easier to handle sorting and queries. (sort by date, pull only the read onyl files, ...).
Database will also help if you want to show history or statistique.
You can save file in some directory and can save path of that file in database. You can also store size and created date of that file in DB. But storing a file in DB is a bit difficult. Rather than save file in Directory and save path of that file in DB
you could store the file information in a database to built some extra features like "avoid storing duplicate files", because you are having a faster search in the database! if you search the filesystem always a recursive function call get started
So I did some research on checking an uploaded pdf for viruses and I found these 2 solutions:
Save the file to the hard disk, let the antivirus quarantine/delete it if it was infected, then check if the file still exists on the disk.
Use an antivirus that supports calling it through .net and scan the file
What I am thinking instead is to read the uploaded pdf file stream using something like iTextSharp then writing a new file but after stripping any macros.
One of the benefits would be making sure that the uploaded file is a pdf since it will be parsed by the iTextSharp, but would it also protect it from viruses?
I'm working on an asp.net /c# app
I need my app to allow users to upload .XLS files (located on the user machine).
How can i read data from the .XLS file but without saving the file on server?
tks
In order to be able to do something with the file on the server (eg using ASP.net ) you will have to at least temporarily save the file on the server. Although an apache module might let you interupt the stream as it is uploaded, but thats probably a bit ott.
There MAY be something you could do in Javascript but I doubt it.
An idea would be to parse .csv files, if it possible. I can send example.
Also you can parse .XLS files through interop excel dll. But it very slow method.