How to use url as file name to upload?

I want to download these 2 app.zip files from the server:

https://tempapps.myserver.com/apps%2FNews%2Fapp.zip

https://tempapps.myserver.com/apps%2Fsports%2Fapp.zip

When I download these files using mozilla, it downloads them as apps_news_app.zip and apps_sports_app.zip .
I want to achieve the same in my program.

+3
source share
2 answers

To get a normal human URL from a percentage code:

QString humanReadable = QUrl::fromPercentEncoded("https://example.com/something%20here.zip");

To get the percentage code:

QUrl myUrl("https://example.com/something here.zip");
QString percentEncoded = myUrl.encoded();

, QUrl.

+5

java, -

String newUrl = "whatever the url is".replace("\%2F", "_");

http://doc.qt.io/qt-5/qstring.html .

, . , .

+3

Source: https://habr.com/ru/post/1780827/


All Articles