Ver Mensaje Individual
  #1  
Antiguo 19-07-2013
JuanOrtega JuanOrtega is offline
Miembro
NULL
 
Registrado: sep 2011
Posts: 130
Reputación: 15
JuanOrtega Va por buen camino
Problema con subir archivos

Hola estoy tratando de subir un archivo con el api de imageshack.

El codigo que tengo es este :

Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
var
  par: TIdMultiPartFormDataStream;
  rta: string;
  Response: TStream;

begin


//Response := TMemoryStream.Create;
//rta:=IdHTTP1.Post('https://post.imageshack.us/upload_api.php', 'test.jpg', Response);


  par := TIdMultiPartFormDataStream.Create;
  par.AddFormField('key', 'mikey');
  par.AddFormField('fileupload','test.jpg');
  par.AddFormField('format', 'json');

  rta := IdHTTP1.Post('https://post.imageshack.us/upload_api.php', par);
  Memo1.Lines.Add(rta);

end;

Y no me sube nada aparte de mostrar este error :

Exception class EIdIOHandlerPropInvalid with message 'IOHandler value is not valid

Tambien intente agregando esto :

Código Delphi [-]
par.AddFile('fileupload', 'test.jpg','application/octet-stream');

Pero es lo mismo.

¿ Alguien me podria ayudar ?
Responder Con Cita