WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

How to

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Copying files with WebBatch

Keywords:      webbatch copying files

Question:

I'd like to use WebBatch in my corporate intranet to copy files from a user's PC to a directory on my web server.

Are there WebBatch functions to help me with this?

Answer:

Basically;
  1. You set up a file upload form to transfer the file from the user's machine to WebBatch.

  2. In WebBatch you use WebParamBuf to get the contents of the file into a binary buffer.

  3. Then you can use a BinaryWrite to write the BinaryBuffer to disk.

Question:

I was looking at this article and tried to utilize it to copy files over my intranet from a users machine to my Personal Web Server. In the steps that are outlined it states that

Step 1 in the article says to create a file upload form to pass the file from the user's machine to the WebBatch...(I think I have done this with the javascript fileupload object.)

Step 2 says to use the WebParamBuf command to get the contents of the file into a binary buffer. (When I do this I get the filename into the buffer and not the file contents itself.)

What am I doing wrong. Is the WebParamBuf only for form variables? How do I get the contents of the file into the WebParamBuf or is there another command? Thanks

Answer:

File uploads are quire tricky and only be done with multipart/form-data type encoding.

I would suggest first making a simple HTML page using a form template like below.

Then make it work so you can upload a file.

Then go back to the method you are trying to use now.


<form enctype="multipart/form-data" method="post" action="/webcgi/webbatch.exe?yourscript.web">
<input type=file name="upl-file" size=80>         
<input type=text size=40 maxlength=40 name="desc">         
<input type="radio" name="another" value="yes">
<input type="radio" name="another" value="no" checked>
<input type=submit value="Upload Now">
</form>

Article ID:   W12473
Filename:   Copy Files using Webbatch.txt
File Created: 2001:01:25:13:38:22
Last Updated: 2001:01:25:13:38:22