TWebFileUpload duplication

I'm using TWebFileUpload for the first time, and am uploading a single file using a PHP script on the server side. It is activated by a button click on the webpage, and executes:
TheResult := 0;
try
WebLabel2.Caption := WebLabel2.Caption + ' A ';
WebFileUpload1.Files[0].Upload(sUrl);
except
WebLabel2.Caption := WebLabel2.Caption + ' B ';
TheResult := 1;
end;

I put in the 'WebLabel2.Caption' thing to see if it's executing twice. It isn't.

But the php URL is being called twice - I put in an (php) error_log call to check that the page load was executing more than once, and it is. The url has no parameters, so is just the php file on a webserver.

I've looked through the properties on the TWebFileUpload to see if there's something I've missed that might cause this, but I haven't found anything.

Has anyone come across this? Is there something that I should be watching out for?

thanks

Stephen

I cannot see from where this would come.
From TFile.Upload(), there is only one HTTP request executed.
Can you use event handlers for the WebFileUpload.OnUpload* events to see what these event handlers tell about the activity of uploading?

OK, thanks
It turns out that it was being caused by an HTTP 'OPTIONS' request which occurs before the POST of the FileUpload. Other than the 'OPTIONS" keyword, the request is exactly the same as the subsequent POST.
I've excluded OPTIONS from the CORS and it's now fine.
Interesting.

Stephen

1 Like