Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Internet (https://www.clubdelphi.com/foros/forumdisplay.php?f=3)
-   -   UrlDownloadToFile no descarga fichero (https://www.clubdelphi.com/foros/showthread.php?t=84546)

aposi 01-11-2013 19:09:51

UrlDownloadToFile no descarga fichero
 
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;

aposi 01-11-2013 19:40:59

Esta resuleto, el problema es que en la variable url tenia www.loquesea/fichero y lo he resuleto
Código Delphi [-]
url := 'http:\\'+url;

esto de trabajar en festivo no es bueno:)


La franja horaria es GMT +2. Ahora son las 18:46:01.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi