Upload file on the response of first upload file - java

What I want to do it so upload multiple files (in java), I know how to upload single file or multiple files in a single request but what I require is a bit different.
I just want to upload a file and on the response of upload the second file. How can I achieve this? I have all the paths stored in Arraylist. Is there any library or easy way to do this?
I want to make this thing generic.
Any kind of help would be greatly appreciated. :)

Related

Java Servelet 3.0 File Upload to input stream - without intermediate folders or files being created

I dont know how to do this, or whether is possible or wise, so any form of answer that points me to a library, example or reasoning will be helpful.
I need to upload and process some Java XML files (actually, XSLT files - XML Excel files).
I dont want to store the file on the server and then invoke processing on it. Instead, I want to stream the file in, and process it as a stream.
I also want to be able to process multipart file uploads, but still process that as an input stream.
I am expressly trying to avoid creating a file on disk for this.

Need to upload and parse 15MB files, open files twice?

I have a file which I need to upload to a service, and parse into relevant data. The parser and the uploader both require an InputStream. Ought I to open the file twice? I could save the file to a String, but having many of these files in memory is concerning.
EDIT: Thought I should make it clear that the parsing and uploading are entirely separate processes.
Since you are parsing it already it would be most efficient to load the file into a string. Parse it into indexes to the string, you will save memory and can just upload the string whenever you want to. This would be the most effective way, with memory but maybe not processing time.
A reply to one of the comments above.
Separate processes does not mean different threads or processes, just they do not need each other to operate.

How to add a custom tag to a file (mostly images) which is uploaded to a server, and the tag is read through a php script to sort it?

When a file is uploaded to a php server, I am trying to figure out a way to get files sorted. What I want to do is add a custom tag to each file programmaticly in android, upload it to the server (which I have alreay done), and read that tag through a php script.
Thanks for the help
Exif seems to be the way to go for adding metadata to an image. See this related question.
I actually don't think this is the best way to solve you problem. You shouldn't modify the physical image just to introduce some ordering. What exactly do you want to accomplish? You just want to have the same order on the server that you had on the device? What about you send the order in a separate piece of data, say JSON or so?

Upload multiple files to azure blob at a time

i am trying to upload files to azure blob, i have referred this code for the same.
and i am able to successfully upload files too, my problem is..
using this code i have to upload files one by one and i am getting more than one files at a time so each time i need to iterate over the list and pass files one by one
what i want to do is to upload all files to azure blob in one go.
i tried searching on internet but unable to find any way :(
please help
Not relevant to Java, but you may check out the AzCopy tool which might be useful to you. It supports uploading blobs in parallel.
http://blogs.msdn.com/b/windowsazurestorage/archive/2012/12/03/azcopy-uploading-downloading-files-for-windows-azure-blobs.aspx
http://blogs.msdn.com/b/windowsazurestorage/archive/2013/09/07/azcopy-transfer-data-with-re-startable-mode-and-sas-token.aspx

How to make client download xml file from server?

My server is implemented with few servlets when each one is responsible for different task.
I need to make client to download a specified xml file from server when a SAVE button in html page pressed.
I've read that the best way is to host file on server and just let client download, but I don't know how to implement it.
Any example will be highly appreciated. :)
p.s.
I'm using JAVA.
Do these steps:
Set proper MIME-type for your file. If you do not want (there's no suitable MIME-type) to set MIME-type specific to your file type, then set it to application/octet-stream
Set content length to the response
Set content disposition
Open output binary stream, then read your file and write its contents to this output stream.
That's it.
Here is the sample code

Categories

Resources