I'm trying to upload a file through the HTTP POST.
I use the following components:
I don't like the appearance of the WebFileUpload1, so I put its property Visible to false.
In the OnChange event of the WebFilePicker1 I put the following code:
and in its OnGetFileAsText event I put the code:
myFile.Name := webfilepicker1.Files.Name;
myFile.Size := webfilepicker1.Files.Size;
I set the following properties of WebHttpRequest1:
Finally in the OnClick event of WebButton1 I put the code:
WebHttpRequest1.PostData := 'uplodFile=' + WebFileUpload1.Files.Name;
The server replies with an error, because the uploadFile is undefined. Nevertheless the following HTML code works well with the same server:
<input type="file" name="uploadFile" />
<input type='submit' value='Upload!' />
What am I doing wrong?