File Uploader

Version 1.12 (February 2010)
Copyright © 2002-2010, Noël DANJOU
All rights reserved.


Welcome

File Uploader is a small command-line tool that allows you to upload one or more files (wildcards allowed) to HTTP and FTP servers. It can be easily used in a script, a batch file or the Task Scheduler to automate resources uploads.

Note: versions 1.11 and later are Unicode versions only which means that they only run in Windows 2000 and later. Windows 98 and ME are not supported anymore.

Table of Contents
Welcome
Package Content
Syntax
Authentication
Return Codes (ERRORLEVEL)
Status Codes
How To...
Known Issues
History
Latest Version
Registration
Redistribution
Contact Details

Package Content

The File Uploader package is provided as a compressed (zip) archive that holds a few files. The included files are described in the table below.

File Description
upload.exe File Uploader program.
logenc.exe Credentials Encoder program (see Authentication).
wait.exe Program whose purpose is to wait for a specified time period or until any key is pressed. It is similar to the TIMEOUT command in Windows Vista and later. It is used in the sample.bat example.
sample.bat Script that shows a way to use upload.exe in a batch file.
post.asp Sample script for use with the /post parameter (see Syntax).
batch.txt Sample text file that shows how to use the /batch parameter to upload many files from different folders in one call.
readme.htm This file.
license.htm File only included with the full version.

Syntax

File Uploader features many parameters, for a whole list of the supported parameters and a description, type the following command in a Command Prompt:

upload /?

The simplest syntax only requires the local filename of the file to upload and the destination URL, e.g.:

upload file.zip https://www.server.com/data/

This command uploads the local file.zip file in the current folder to the /data virtual folder on the webserver at www.server.com. The folder on the server must have appropriate permissions set and the webserver must support and accept the PUT verb.

If the URL points to a folder and not to a file, it must ends with a trailing slash so that the program knows that it actually is a directory name not a file name.

If the webserver does not support the PUT verb, you can upload a file using the POST verb instead. To do so, append the /post parameter and specify the URL to an upload script on the server (a post.asp sample script is provided for this purpose), e.g.:

upload file.zip https://www.server.com/scripts/post.asp?vpath=/data/file.zip /post

Another alternative would be to use a FTP upload if a FTP server is available, e.g.:

upload file.zip ftp://ftp.server.com/public/data/

Notes:


Authentication

When authentication is required on the server, you can pass the login and password to the program, either as clear-text or in an encrypted form.

Clear-text authentication

The clear-text login and password are simply passed as third and fourth parameters after URL, e.g.:

upload <file> <url> mylogin mypassword [...]

or using the /credentials parameter like this:

upload <file> <url> /credentials:mylogin,mypassword [...]

Encrypted authentication

If you prefer to use encrypted credentials so that no one can see the login and password, you first have to create a credential file using the provided logenc.exe program. This program takes the login and password as parameters and optionally a credential filename. If no filename is specified, the default filename (credentials.dat) is used, e.g.:

logenc mylogin mypassword

or with an alternate output filename:

logenc mylogin mypassword server.bin

You can then use the credential file with upload.exe, e.g.:

upload <file> <url> [...] /credentials:credentials.dat

or

upload <file> <url> [...] /credentials:server.bin

Notes:


Return Codes (ERRORLEVEL)

When File Uploader is used in a batch file, you can use ERRORLEVEL to check the completion code returned by the program. The possible return codes are listed in the table below. See the sample.bat example for a way to test the return codes.

Code Description
0 Success.
1 Syntax error, invalid URL or help/registration information displayed.
2 Source file or folder error.
3 Invalid URL.
4 Upload failed.
5 Deletion failed.
6 System error (e.g. out-of-memory).
7 Batch file error.

Status Codes

The table below lists some of the status codes that may be reported when an upload fails. The short description should give you some hints at what might be wrong.

For more information, please see Microsoft Knowledge Base article ID 943891.

Code Description
200 Success (file successfully updated).
201 Created (file successfully created).
400 Syntax error.
401.3 Access denied.
403 Request forbidden.
404 Resource not found.
405 Method not allowed.
500 Internal server error.
501 Not implemented.

Notes:


How To...

How to delete a file on a server?

To delete a single file on a web server without uploading any other file, use the /delete parameter and pass nul as the filename, e.g.:

upload nul https://www.server.com/data/file.zip /credentials:mylogin,mypassword /delete

With FTP servers, you can also use wildcards to delete multiple files at once, e.g.:

upload nul ftp://ftp.server.com/data/*.zip /credentials:mylogin,mypassword /delete

or you can even delete a whole tree by specifying a path and the /subdir parameter, e.g.:

upload nul ftp://ftp.server.com/data/ /credentials:mylogin,mypassword /delete /subdir

 

How to configure an IIS6.x server to accept uploads?

1. Enable uploads.

2. Optionally enable securities.

 

How to configure an IIS7.x server to accept uploads?

1. Install WebDAV.

2. Enable WebDAV.

3. Allow members of the Administrators group to upload files.

4. Configure authentication and security.

Notes:


Known Issues


History

February 23, 2010 - Version 1.12 (build 66.2)

  • Adds a /batch parameter to support batch uploads. The parameters in the batch file override the command-line parameters.
  • Adds a /utf8 parameter to enable UTF-8 support on some FTP servers (opts utf8).
  • Fixes an issue with the /validate parameter. The paths were possibly not correctly parsed and validation could fail.
  • Fixes an issue that could lead to paths, with dots in some folder names, being mistakenly identified as filenames.
  • The /proxy parameter is now available in the demo version.
  • The /deleteonly parameter was removed since it is not needed anymore, you can use "nul" (w/o quotes) as the file name and the /delete parameter instead.
  • Displays upload duration at the end of the whole process.

April 9, 2008 - Version 1.11 (build 56.3)

May 30, 2007 - Version 1.10 (build 46.3)

May 24, 2007 - Version 1.10 (build 45.4)

June 26, 2006 - Version 1.09 (build 41.1)

January 17, 2006 - Version 1.09 (build 39.2)

December 6, 2005 - Version 1.09 (build 37.2)

October 14, 2005 - Version 1.09 (build 36.4)

July 23, 2005 - Version 1.08 (build 27.6)

June 24, 2005 - Version 1.07 (build 20.5)

May 31, 2005 - Version 1.06 (build 17.2)

May 12, 2005 - Version 1.05 (build 16.3)

March 9, 2005 - Version 1.05 (build 15.3)

September 22, 2004 - Version 1.04 (build 12.3)

August 25, 2004 - Version 1.03 (build 10.3)

July 31, 2004 - Version 1.02 (build 6.6)

December 23, 2002 - Version 1.01 (build 4.1)

December 21, 2002 - Version 1.0 (build 3.6)


Latest Version

The latest demo version of File Uploader is always available for download from this address:

http://noeld.com/programs.asp?cat=misc#upload


Registration

The demo version of this application only features a subset of the parameters supported by the registered version. When advanced parameters are used with the demo version, a REGISTRATION REQUIRED message will be displayed and the parameters will be ignored.

To register, click the link just below and follow the instructions.

https://www.regnow.com/softsell/nph-softsell.cgi?item=4076-8

Alternatively, you can type the following command in a Command Prompt to open the registration page in the default browser:

upload /register

Orders and delivery are handled by the Register Now company.


Redistribution

Computer magazine publishers are welcome to redistribute the demo application as-is on their complimentary or monthly CDs. Any other redistribution of the application with commercial products is strictly forbidden without my written permission. Please contact me for a license agreement (see Contact Details).


Contact Details

E-mail: webmaster@noeld.com

WWW: http://noeld.com/