EzDevInfo.com

download interview questions

Top download frequently asked interview questions

Set timeout for webClient.DownloadFile()

I'm using webClient.DownloadFile() to download a file can I set a timeout for this so that it won't take so long if it can't access the file?


Source: (StackOverflow)

How to download all files (but not HTML) from a website using wget?

How to use wget and get all the files from website?

I need all files except the webpage files like HTML, PHP, ASP etc.


Source: (StackOverflow)

Advertisements

How to make PDF file downloadable in HTML link?

I am giving link of a pdf file on my web page for download, like below

<a rel='nofollow' href="myfile.pdf">Download Brochure</a>

The problem is when user clicks on this link then

  • If the user have installed Adobe Acrobat, then it opens the file in the same browser window in Adobe Reader.
  • If the Adobe Acrobat is not installed then it pop-up to the user for Downloading the file.

But I want it always pop-up to the user for download, irrespective of "Adobe acrobat" is installed or not.

Please tell me how i can do this?


Source: (StackOverflow)

Having Django serve downloadable files

I want users on the site to be able to download files whose paths are obscured so they cannot be directly downloaded.

For instance, I'd like the URL to be something like this, "http://example.com/download/?f=somefile.txt

And on the server, I know that all downloadable files reside in a folder "/home/user/files/".

Is there a way to make Django serve that file for download as opposed to trying to find a URL and View to display it?


Source: (StackOverflow)

How to change the timeout on a .NET WebClient object

I am trying to download a client's data to my local machine (programatically) and their webserver is very, very slow which is causing a timeout in my WebClient object.

Here is my code:

WebClient webClient = new WebClient();

webClient.Encoding = Encoding.UTF8;
webClient.DownloadFile(downloadUrl, downloadFile);

Is there a way to set an infinite timeout on this object? Or if not can anyone help me with an example on an alternate way to do this?

The URL works fine in a browser - it just takes about 3 minutes to show.


Source: (StackOverflow)

Visual C++ 2008 Express Download Link Dead? [closed]

the programming class I am currently taking uses Visual C++ 2008, and to work from home, we have the option of getting the express edition. I can't find the download link anywhere on the website, and the Microsoft support was absolutely no help. I also looked into just using Visual C++ 2010 but I heard there isn't much of a chance for compatability to work. If anyone has information on where I can get the Visual Studio 2008 express ISO or the C++ 2008 express download seperately, then let me know.


Source: (StackOverflow)

Download a file with Android, and showing the progress in a ProgressDialog

I am trying to write a simple application that gets updated. For this I need a simple function that can download a file and show the current progress in a ProgressDialog. I know how to do the ProgressDialog, but I'm not sure how to display the current progress and how to download the file in the first place.


Source: (StackOverflow)

How to download and save a file from Internet using Java?

There is an online file (such as http://www.example.com/information.asp) I need to grab and save to a directory. I know there are several methods for grabbing and reading online files (URLs) line-by-line, but is there a way to just download and save the file using Java?


Source: (StackOverflow)

Create a CSV File for a user in PHP

I have data in a MySQL database. I am sending the user a URL to get their data out as a CSV file.

I have the e-mailing of the link, MySQL query, etc. covered.

How can I, when they click the link, have a pop-up to download a CVS with the record from MySQL?

I have all the information to get the record already. I just don't see how to have PHP create the CSV file and let them download a file with a .csv extension.


Source: (StackOverflow)

Using HTML5/Javascript to generate and save a file

I've been fiddling with WebGL lately, and have gotten a Collada reader working. Problem is it's pretty slow (Collada is a very verbose format), so I'm going to start converting files to a easier to use format (probably JSON). Thing is, I already have the code to parse the file in Javascript, so I may as well use it as my exporter too! The problem is saving.

Now, I know that I can parse the file, send the result to the server, and have the browser request the file back from the server as a download. But in reality the server has nothing to do with this particular process, so why get it involved? I already have the contents of the desired file in memory. Is there any way that I could present the user with a download using pure javascript? (I doubt it, but might as well ask...)

And to be clear: I am not trying to access the filesystem without the users knowledge! The user will provide a file (probably via drag and drop), the script will transform the file in memory, and the user will be prompted to download the result. All of which should be "safe" activities as far as the browser is concerned.

[EDIT]: I didn't mention it upfront, so the posters who answered "Flash" are valid enough, but part of what I'm doing is an attempt to highlight what can be done with pure HTML5... so Flash is right out in my case. (Though it's a perfectly valid answer for anyone doing a "real" web app.) That being the case it looks like I'm out of luck unless I want to involve the server. Thanks anyway!


Source: (StackOverflow)

Returning a file to View/Download in ASP.NET MVC

I'm encountering a problem sending files stored in a database back to the user in ASP.NET MVC. What I want is a view listing two links, one to view the file and let the mimetype sent to the browser determine how it should be handled, and the other to force a download.

If I choose to view a file called SomeRandomFile.bak and the browser doesn't have an associated program to open files of this type, then I have no problem with it defaulting to the download behavior. However, if I choose to view a file called SomeRandomFile.pdf or SomeRandomFile.jpg I want the file to simply open. But I also want to keep a download link off to the side so that I can force a download prompt regardless of the file type. Does this make sense?

I have tried FileStreamResult and it works for most files, it's constructor doesn't accept a filename by default, so unknown files are assigned the a file name based on the url (which does not know the extension to give based on content type). If I force the file name by specifying it, I lose the ability for the browser to open the file directly and I get a download prompt. Has anyone else encountered this.

These are the examples of what I've tried so far.

//Gives me a download prompt.
return File(document.Data, document.ContentType, document.Name);

//Opens if it is a known extension type, downloads otherwise (download has bogus name and missing extension)
return new FileStreamResult(new MemoryStream(document.Data), document.ContentType);

//Gives me a download prompt (lose the ability to open by default if known type)
return new FileStreamResult(new MemoryStream(document.Data), document.ContentType) {FileDownloadName = document.Name};

Any suggestions?


Source: (StackOverflow)

How do I ZIP a file in C#, using no 3rd-party APIs?

I'm pretty sure this is not a duplicate so bear with me for just a minute.

How can I programatically (C#) ZIP a file (in Windows) without using any third party libraries? I need a native windows call or something like that; I really dislike the idea of starting a process, but I will if I absolutely have to. A PInovke call would be much better.

Failing that, let me tell you what I'm really trying to accomplish: I need the ability to let a user download a collection of documents in a single request. Any ideas on how to accomplish this?


Source: (StackOverflow)

Do I need Content-Type: application/octet-stream for file download?

The HTTP standard says:

If this header [Content-Disposition: attachment] is used in a response with the application/octet-stream content-type, the implied suggestion is that the user agent should not display the response, but directly enter a `save response as...' dialog.

I read that as

Content-Type: application/octet-stream
Content-Disposition: attachment

But I would have thought that Content-Type would be application/pdf, image/png, etc.

Should I have Content-Type: application/octet-stream if I want browsers to download the file?


Source: (StackOverflow)

How do I measure request and response times at once using cURL?

I have a web service that receives data in JSON format, processes the data, and then returns the result to the requester.

I want to measure the request, response, and total time using cURL.

My example request looks like:

curl -X POST -d @file server:port

and I currently measure this using the time command in Linux:

time curl -X POST -d @file server:port

The time command only measures total time, though - which isn't quite what I am looking for.

Is there any way to measure request and response times using cURL?


Source: (StackOverflow)

How to download/checkout a project from Google Code in Windows?

How do I download a ZIP file of an entire project from Google Code when there are no prepared downloads available?

This is what I see on the checkout page:

Command-line access
Use this command to anonymously check out the latest project source code:

svn checkout http://myproject.googlecode.com/svn/trunk/ myproject-read-only

But I'm working on Windows and I don't have the svn binaries ... do I need these?

I can access individual source code file or view the Subversion HTML pages, but that just allows me to access source code files one-by-one.


Source: (StackOverflow)