tengo el siguiente codigo para descargar unos ficheros de una web
pero la funcion UrlDownloadToFile me devuelve el valor -2146697203
buscando por internet he encontrado que este codigo de error es:
INET_E_UNKNOWN_PROTOCOL
The protocol is not known and no pluggable protocols have been entered that match.
si entro con el explorardor a la url me muestra perfectamente el fichero (es un fichero de texto)
Código Delphi
[-]
re := UrlDownloadToFile(nil, PChar(url), PChar(origen), 0, nil);
if re = 0 then begin
if tamanofichero(Qpedid_order.AsString +'-'+Qpedreference.Value) > 0 then begin
log('descargado fichero ' + Qpedfichero.Value);
if CBSERV.Checked then begin
origen := Qpedid_order.AsString +'-'+Qpedreference.Value;
destino := dir.Text + '\'+Qpedid_order.AsString +'-'+Qpedreference.Value;
Success := movefile(pchar(origen), pchar(destino));
if not Success then begin
ErrCode := GetLastError;
log ('Error '+ inttostr(ErrCode) + ' directorio no encontrado '+ destino);
end else log ('fichero movido a '+dir.Text + '\'+Qpedid_order.AsString +'-'+Qpedreference.Value);
end;
end else begin
log('fichero vacio' + Qpedfichero.Value);
end;
end else begin
log('No se ha descargado ' + url + ' resultado '+ inttostr(re));
end;