PDA

View Full Version : download password protected zip file from website



Rajesh.Rathod
9th September 2016, 17:01
Dear All,
I would like to download zip file from website which is password protected.
I am using QNetworkAccessManager and using which I can successfully download text file but no luck for zip file.

Note that to open this zip file password is required.

I am using Qt 5.3 on windows.

Thanks,

d_stranz
9th September 2016, 17:26
There is no difference between downloading a text file and downloading a zip file, except that one is ASCII and one is binary. Reading a passworded zip file has nothing to do with QNetworkAccessManager. Its encryption and authentication methods apply to the connection, not to what is retrieved during a transaction.

Rajesh.Rathod
9th September 2016, 19:37
I read documentation but couldn't find out what should be encryption and authentication settings here to read zip file.
Please help, if someone has any idea.

Thanks,

jefftee
10th September 2016, 00:04
I read documentation but couldn't find out what should be encryption and authentication settings here to read zip file.
Please help, if someone has any idea.
More than likely, the code you're using to write out those contents is where you have the problem. Please show your code where you read the bytes from the reply and write them to a file.

d_stranz
10th September 2016, 20:01
I read documentation but couldn't find out what should be encryption and authentication settings here to read zip file.

As I said (and jefftee also said), the QNetworkAccessManager authentication applies to accessing the file on the web site, not reading the file after it is downloaded. You are confusing encryption of the file with encryption (eg. password-restricted access) to the site. You can get to the site, that's not the issue.

And as I also said, text files are ASCII, ZIP files are binary. If you are using a protocol that transfers the ZIP file as if it were ASCII, then you are not getting a binary file on your local disk, you are getting an ASCII file. Look at the protocol you are using to both read the file from the server and write it to the disk. If one or the other (or both) is assuming the file is ASCII, then your protocol is wrong.