Hello,
I am trying to upload a small file via http with TWebCopy. This is the delphi code:
WebCopy.Items.Clear;
with WebCopy.Items.Add do begin
protocol := wpHTTPUpload;
URL := 'http://www.mydomain.de/getupdate.php';
TargetDir := 'c:\temp';
TargetFileName := 'x.txt';
end;
WebCopy.Execute;
This is the php file:
<?
$target_path = "user/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>
There is no error returned, it simply does nothing. If I try to upload the file from a simple html frame, it works. This is the html frame:
<form enctype="multipart/form-data" action="getupdate.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
What am I doing wrong?
Thanks in advance for your help.