Version 1.13 (August 2013)
© 2002-2013, Noël DANJOU
All rights reserved.
Table of Contents |
---|
Welcome |
Package Contents |
Syntax |
Authentication |
Return Codes (ERRORLEVEL) |
Status Codes |
How To... |
Known Issues |
History |
Latest Version |
Registration |
Redistribution |
Contact Details |
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.
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 | The File Uploader program. |
logenc.exe | Credentials Encoder program (see Authentication). |
wait.exe | Program whose purpose is to wait for a specified amount of time 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. |
File Uploader features many parameters, for a whole list of the supported parameters and a description, type the following command in a Command window:
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:
upload "LFN with blanks.zip" https://www.server.com/data/ /credentials:"my login","my-password"
upload "%userprofile%\Desktop\file.zip" https://www.server.com/data/or
upload ..\backup\file.zip https://www.server.com/data/
Unsupported Internet scheme: HTTP, HTTPS or FTP expected.
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.
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 [...]
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
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. |
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. |
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
1. Enable uploads.
2. Optionally enable securities.
1. Install WebDAV.
2. Enable WebDAV.
3. Allow members of the Administrators group to upload files.
4. Configure authentication and security.
Notes:
The latest demo version of File Uploader is always available for download from this address:
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://shopper.mycommerce.com/checkout/cart/add/4076-8
Alternatively, you can type the following command in a Command window to open the registration page in the default browser:
upload /register
Orders and delivery are handled by MyCommerce (a Digital River company).
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).
E-mail: webmaster@noeld.com
Website: noeld.com