Silently upload file using hta (hypertext application)

I’ve got a pc which will hold some log files, and I want to get them onto my server.

Rather than use a combination of batch scripts, ftp, and cron jobs, I thought I’d try using an hta htpertext application on the local machine, to upload the log file.

So I’m trying to do a hta file that will upload a specified file via a self-submitting (javascript), then close itself, but I’m having 2 problems:

  1. Specifying the file name as the value of the file in the form doesn’t seem to have any effect. The form comes trhough with a blank field.
  2. On submitting the form to the server, it opens an IE window to view the returned page (even if it’s blank). If I ran the script every 10 minutes or whatever, the screen and memory would soo get full.

I know there aren’t a lot of people using hta files, but any ideas?

Here’ s the code I’m using:


<form enctype="multipart/form-data" 

action="http://myserver/form.php" 

method="POST" name="form1">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
<input name="uploadedfile" type="file" value="test_upload.txt"/>
<input type="submit" value="Upload File" />
</form>

<script>

document.forms.form1.submit();
window.close();
</script>

Ah, well if that’s the case then I might as well abandon that route and go back to plan A. Thanks for the clarification. I must say I’ve never tried to set the value of file inputs using javascript.

I’m not sure about the .hta you’re using, but as far as I know, you can’t set the value of file inputs using javascript or the value attribute.