Solved Download a file from URL have space
-
@SGaist i test this but no difference
Error is : server replied: Not Acceptable -
Can you show what you are entering and what you URL is used to do your request ?
-
@SGaist I test this pic :
http://www.mlhsartgallery.org/DS10sem1/V_Boswell/dawn%20pic%204.bmp
-
@ARASHz4 Did you try setting the QUrl to strict mode and see if it is valid?
That url should work just fine, so there must be some problem in how you are setting your url.
-
-
@ambershark yes is valid
Url = QUrl::fromUserInput(ui->addressLineEdit->text()); qDebug()<<Url.isValid();
return me true but i can't download this file!
-
@ARASHz4 I'll write a quick test app and see if it works for me..
-
The problem is not the URL. You are getting a 406 error.. Basically, the server tells you that your query is missing some stuff.
QNetworkRequest request(url); request.setRawHeader("Accept", "*/*"); request.setRawHeader("User-Agent", "name-of-your-application");
-
-
It's setting the HTTP Accept (definition 14.1) and User-Agent (definition 14.43) header. See RFC2616.