I am uploading large files to server about 4-5 GB. I have currently used HTML 5 and javascript var reader = new FileReader(); to upload the file payload chunk by chunk to the action method and it will write to the file.
Problem with current uploading is if the user navigate to another tab in application or accidentally close the browser, file upload will stop because it's getting chunk using javascript on page. My requirement is also just upload and forget some background task will upload it for you.
I need some background thread that handle the file upload and upload the file in background. Like file upload queue. So if the user navigate to other page the file upload won't stop and continue in background.
Is this possible with web application? I did my research and found that thread is not a good idea on IIS, instead windows service should be used. But don't know how to do this.
I am not a pro so any idea/example will be helpful. Thanks.
Related
I'm attempting to automate a task I have of interacting with a website form to download a file.
In human terms, I select a label from a list of options, and then press a submit button. The website then automatically downloads a zip file to the downloads folder.
The actions described above have the net effect of running this code in a browser console:
$('#ListBox1').val($('#ListBox1 option:first')) && $('#Download_0').click()
My question is, how can I download this zip file by running the code from a C# program? Ideally, I would also be able to specify where the file downloads to, although I'm not sure if this is possible.
Please note, this question is not asking how to download a file using C# (see: How to download a file from a website in C# and .net - Downloading a file from a website using C#). No such file exists on the website for me to download. The resulting file is generated and downloaded automatically by the two actions above.
EDIT:
The following code does download a file, however, the file is 24kb (the zip file I'm expecting is around 8mb) and unopenable:
using (WebClient client = new WebClient())
{
client.DownloadFile("https://cdr.ffiec.gov/public/PWS/DownloadBulkData.aspx", AppDomain.CurrentDomain.BaseDirectory + "download.zip");
}
EDIT2:
What I'm attempting to do is download the most recent zip file available containing bulk call report data. The website selects the most recently available data automatically, but I have to manually select the type of file I want to download. As such, the web request won't be static and can't be hard-coded into the program, which is why I'm attempting to interact with the webpage.
I am working on a project in which I have to implement file upload functionality, User will upload the file, while uploading I have to do two things
1: Send Email to admin
2: Make Zip file of uploaded file.
I have to show Progress bar during these 2 processes like below
I have tried using this but it doesn't support manually start on button click event. How can I Implement this functionality
You can use a third-party upload control for that, such as SlickUpload.
You will have to start it in a new thread and when the process is done you will have to stop it. Use a session variable to control if its started or finished.
I have a page that downloads a large HTML file from another domain then serve it to the user. The file is around 100k - 10MB and usually takes about 5min. What was think about doing something like this to make the user experience better.
download file
if file is not download within 10 seconds then displays a page that tells the user that the file is being downloaded
if the server completes the download in 1 second then it will serve the downloaded html
can this be done? do I need to use the async feature?
Updated question: the downloaded file is a html file
In order to provide an 'asynchronous' file download try a trick that Google is using: Create a hidden iframe and set it's source to the file you want to download. You can then still run javascript on your original page while the file is being downloaded through the iframe.
I think you should:
Return an HTML page to the user straight away, to tell them the transfer has started.
Start the download from the other domain in a separate process on your server.
Have the HTML from step 1 repeatedly reload, so you can check if the download has completed already, and possibly give an ETA or update to the user.
Return a link to the user when the initial transfer is complete.
It sounds like you need to use a waiting page that refreshes itself every so often and displays the status of your download. The download can be run on a separate thread using a System.Threading.Task, for instance.
Dear friends
I have a console application in which i want to first sign in and then I press button which directs me to file upload form .In file upload form I want to upload a csv file and then redirect to next form after clicking submit button then i want to get response of that form .
can any one help me to do this from C# console application?
thanks.
if you want to upload a file on a website from a console application,
then you should have information about FTP credentials.
If you want to do a real http-transfer you need to create a http request, I looked around a little bit and found this: Upload files with HTTPWebrequest (multipart/form-data), seems to be right. I'm doing something similar in python currently.
I'm having an issue within my application Pelotonics. When a user downloads a file the system seems to block all incoming requests until that file is done downloading. What is the proper technique to to open a download dialog box (standard from the browser), let the user start downloading the file, then while the file is downloading, let the user continue throughout the application.
The way we're getting the file from the server is we have a separate ASPX page that get's passed in a value through the query string, then retrieves the stream of the file from the server, then I add the "content-disposition" header to the Response and then loop through the file's stream and read 2KB chunks out to the response.outputstream. Then once that's done I do a Response.End.
Watch this for a quick screencast on the issue:
http://www.screencast.com/users/PeloCast/folders/Jing/media/8bb4b1dd-ac66-4f84-a1a3-7fc64cd650c0
by the way, we're in ASP.NET and C#...
Thanks!!!
Daniel
I think ASP.NET allows one simultaneous page execution per session and I'm not aware of any way to configure this otherwise.
This is not a very pretty workaround, but it might help if you rewrote ASP.NET_SESSIONID value to the request cookie in Application_BeginRequest (in global.asax). Of course, you would need to the authentication some other way. I haven't tried this, though.
Another way would be launching a separate thread for the download process, but you would need to find a way how this can be done without the worker thread closing it's resources.
May I ask, is there a reason why don't you just use HttpResponse.TransmitFile?