I need to upload file to my web application using servlet, the problem is that I want the file to be available only in the run time !
I know to upload the file to the server, but I need the file to be available when the user upload the file to the web and do some tasks to the file and when he close the web application he will lose the file and need to upload it again
Would you please give me any tutorial to help me?
I think what you need is a javax.servlet.http.HttpSessionListenerthat delete the file when the user session is destroyed (see method sessionDestroyed(HttpSessionEvent se))
Hope it helps.
Related
Can someone let me know how can we implement a resumeable file upload in dropwizard 1.2.6? So if a user is trying to upload a large file (4-5 GB) and if there is a network failure or the browser is closed by mistake then the user will be able to resume the process from where it was interrupted.
tus.io can be used with dropwizard to support resumable upload. An working example is placed in the below github repo
https://github.com/tomdesair/tus-java-server-dropwizard-demo
I have an android application, which wants the user to login each time he runs the app. So, the login procedure is simple, using the sqlite dabase file i'm using. I've copied the file in assets folder and doing the necessary modifications. But, the database file is of no use unless it is on the server. I don't have any server so i'm thinkin of keeping the database file on dropbox, google drive etc and then read or update that file as per user commands. The question is how to do that? I was searching the web for it, and found that the only way is downloading the db file modifying it and the uploading it back. Can anyone give me an example??
Doing that isn't possible unless you have a server.
Because, if you are using dropbox, first you'll have to make your file public in order to download it (Not recommended at all. Compromises security). Then you can use the url to download the file. But you won't be able to upload it back (Unless you are able to login to dropbox through your Android code).
Instead if you a web server with MySQL n PHP, you can easily send POST requests to your server.
I want to upload a file (picture) to the server (PHP script), but in background. I am searching a very lightweight AsyncTask to do this, but I can't find any useful on Google.
Any Idea how I can upload a file to PHP with an AsyncTask? The upload Function should only get the local file as variable, every else should be not variable...
Maybe somebody can help me with that?
To perform task in background.
You need to create the service and write the logic in that to upload the file to server.
Read here.
When using a form that uploads a file to my Play! Framework application, a file is created in ${application_path}/tmp/ with an unique ID like :
0851e44f-8d7e-4afd-8edf-3d9bd6c909c9
and contains all the data sended by the form (POST & FILES)
I located the creation of this file in :
play.server.StreamChunkAggregator.java:51
But I don't know why this file is not removed when the request is finished.
Is there any reason that the file isn't removed? is it specific to Play (1.2)?
The file should be removed automatically at the end of the request, so something unusual must be going wrong.
Isn't it the classical way of Server API to manage upload files?
Why they are not deleted ? I don't know but I see the same kind of behavior in Tomcat...
We have a web application that allows user to download a zip file from a web server. We just provide dummy iframe source to the full URL of zip file on web server. This approach would allow end user to use browser controls which allows the user to open or save the zip to user's local machine.
We have a requirement that the zip file is automatically extracted and save to a specific location on user's machine. Any thoughts on how this can be achieved?
Thanks.
I highly doubt that you'll be able to do that. The closest you're likely to get is to generate a self-extracting executable file (which would be OS-dependent, of course).
I certainly wouldn't want a zip file to be automatically extracted - and I wouldn't want my browser to be able to force that decision upon me.
Short answer is I don't believe this is possible using the simple URL link you've implemented.
Fundamentally the problem you have is that you have no control over what the user does on their end, since you've ceded control to the browser.
If you do want to do this, then you'll need some client-side code that downloads the zipfile and unzips it.
I suspect Java is the way to go for this - Javascript and Flash both have problems writing files to the local drive. Of course if you want to be Windows only then a COM object could work.
Instead of sending a zip file why don't u instruct the web server to compress all the web traffic and just send the files directly?
See http://articles.sitepoint.com/article/web-output-mod_gzip-apache# for example.