Code: Select all
Output.Clear;
FName = SelectFile('File to upload','');
if FName = Nothing then Terminate;
F = New(File);
F.Open(FName);
F.Seek(BeginningOfFile);
DecodeFileName(FName, [fn, ex], [FileName,Extension]);
Link = New(URL);
Link.Location = Input('Enter the URL to upload the file to:');
if Link.Location = Nothing then Terminate;
Link.Referer = Link.Location;
Link.AddHeader('Content-Type: multipart/form-data; boundary=---------------------------7da23915ad0a2c');
pd = '-----------------------------7da23915ad0a2c'+crlf+
'Content-Disposition: form-data; name="file1"; filename="'+fn+ex+'"'+crlf+
'Content-Type: application/x-zip-compressed'+crlf+crlf+
F.Content+
crlf+crlf+'-----------------------------7da23915ad0a2c--'+crlf;
Link.Post(pd);
Output(Link.ServerText);