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.
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:
- For the sake of clarity, no credentials are specified in the examples above
but authentication is highly recommended. See the Authentication
paragraph for more information.
- Secure HTTP is not required but is highly recommended to
keep credentials away from prying eyes.
- Both long file names (LFN) and clear-text credentials (especially when they
include blanks or special characters) must be quoted, e.g.:
upload "LFN with blanks.zip" https://www.server.com/data/ /credentials:"my login","my-password"
- Absolute paths, relative paths, and environment variables (e.g. %USERPROFILE%) are supported
in both upload.exe and logenc.exe programs, e.g.:
upload "%userprofile%\Desktop\file.zip" https://www.server.com/data/
or
upload ..\backup\file.zip https://www.server.com/data/
- Only addresses beginning with http://,
https:// and ftp:// are supported, all others will
give the following error:
Unsupported Internet scheme: HTTP, HTTPS or FTP expected.
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:
- The extension of the credential file does not matter.
- If the value passed to the /credentials
parameter is a directory, not a filename or a path to a file, the
default filename (credentials.dat) is automatically
appended.
- For webservers running in a domain, mylogin must
be in the form: domain\account
- Credentials encryption will only hide your login and password in
the Command Prompt or in the script. When the credentials are
transmitted over the Internet they will still be in clear text if you
use either FTP or unsecure HTTP.
- The last /credentials parameter before
the /proxy parameter (if any, or the last one in the
command-line otherwise) applies to the target server. The last
/credentials parameter after the /proxy
parameter applies to the proxy server.
- logenc.exe and upload.exe must be used on the same computer
and in the same system otherwise the encrypted credentials won't be
valid and upload.exe won't be able to decrypt them.
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:
- If the webserver reports a 401.3 error
(access denied) after uploading a file using HTTP (PUT), and you have valid credentials, append the /delete parameter to your
command-line and try again.
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.
- Click Start > Control Panel > Administrative Tools.
- Open the Internet Information Services (IIS) Manager.
- Select the subdirectory in the left pane where files will be uploaded.
- Click Properties.
- Click the Directory tab.
- Tick the Write checkbox.
2. Optionally enable securities.
- Click the Directory Security tab.
- Click the Edit... button.
- Clear the Anonymous access checkbox.
- Tick either or both Basic authentication and
Integrated Windows authentication checkboxes.
- Click OK to apply the changes.
How to configure an IIS7.x server to accept uploads?
1. Install WebDAV.
- Click Start > Control Panel > Programs
and Features.
- Click Turn Windows features on or off.
- Tick WebDAV Publishing
under Internet Information Services > World Wide Web Services
> Common HTTP Features.
- Click OK to install the feature.
- Close the Control Panel.
2. Enable WebDAV.
- Click Start > Control Panel > Administrative Tools.
- Open the Internet Information Services (IIS) Manager.
- Select the website to configure under the Sites branch.
- Open WebDAV Authoring Rules in Features View.
- Click Enable WebDAV in the right pane.
3. Allow members of the Administrators group to upload files.
- Select the subdirectory in the left pane where files will be uploaded.
- Open WebDAV Authoring Rules.
- Click Add Authoring Rule...
- Tick All content.
- Tick Specified roles or user groups.
- Type Administrators.
- Tick Read, Source, Write.
- Click OK.
4. Configure authentication and security.
- Open Authentication.
- Disable Anonymous Authentication.
- Enable Windows Authentication.
- Right-click the subdirectory in the left pane where files will be uploaded.
- Click Edit Permissions...
- Click Security tab.
- Click Edit...
- Click Administrators under Group or user names.
- Make sure both Modify and Write are ticked.
- Click OK twice.
Notes:
- This example only show you how to configure securities for members of the Administrators
group. You could alternatively use any other group or specific users.
- If you use a host name that points to the loopback address to upload the files
and since Windows authentication is involved, you may have to follow instructions in
Microsoft Knowledge Base article ID 896861
to disable the loopback check.
- Since WebDAV now requires Windows Authentication, HTTP file upload (PUT) and/or deletion
(DELETE) is not possible over the Internet and can only be completed on a local server
in the same workgroup or domain.
Known Issues
- Files larger than 4GB are not currently supported with the HTTP protocol
because of limitations in the WinInet library.
- Long file names using characters from extended character sets may not be
correctly handled due to a bug in the WinInet library.
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)
- First Unicode release, the program is no more supported on older
Win9x/ME systems.
- Improves overall credential security.
- Improves parameter parsing.
- Improves error reporting during application initialization.
- Source code reorganized and synchronized with
File Downloader. Now
both programs share a common code base.
- Some advanced parameters are now only available in the registered
version.
May 30, 2007 - Version 1.10 (build 46.3)
- Fixes an issue with the /nocerterror parameter that could freeze the program.
May 24, 2007 - Version 1.10 (build 45.4)
- Adds /useragent parameter to override the default user-agent string with a custom one.
- Adds /nocerterror to ignore invalid certifcate errors (https).
- Adds support for files larger than 4GB in size (FTP only).
- Fixes some issues with /if parameter parsing and handling.
June 26, 2006 - Version 1.09 (build 41.1)
- Adds /if parameter to conditionally upload one or more files if their dates
meet the criteria.
January 17, 2006 - Version 1.09 (build 39.2)
- Fixes a bug that prevented the local file from being deleted when the
/move parameter is used.
December 6, 2005 - Version 1.09 (build 37.2)
- Environment variables (e.g. %windir%) are now supported in the path of
the local file.
October 14, 2005 - Version 1.09 (build 36.4)
- The /proxy parameter can now take an optional value which is either
the host name or the IP address of the proxy.
- Adds support for proxy authentication, specify /credentials after
/proxy (HTTP only).
- /credentials now accept login and password in plain-text as well and
may replace the login and password arguments.
- Adds /deleteonly parameter that allows you to delete a
file on the server without requiring any upload. If the URL specifies
a fully qualified path on the server, you can use "nul" (w/o quotes)
as the file name.
- Fixes some related authentication issues.
July 23, 2005 - Version 1.08 (build 27.6)
- Changes progression to a more informational display.
- Adds /display parameter, replaces and extends /silent parameter.
- Now accepts a relative path for the source file(s).
- Removes redundant error codes and messages.
- Updates logenc.exe to automatically create a default key container.
June 24, 2005 - Version 1.07 (build 20.5)
- Fixes an issue with the validation process of the FTP paths (/validate).
- Adds /credentials parameter.
- Adds /timeout parameter.
- Adds /archive parameter, only files with the archive flag are uploaded.
The flag is cleared if the upload completes successfully.
- Displays cumulated number of bytes uploaded.
May 31, 2005 - Version 1.06 (build 17.2)
- Adds /subdir parameter to process both folders and subfolders if
wildcards are used. With HTTP, the same subfolders must exist on the
server. With FTP you can use the /validate parameter to have the missing
folders created.
- Adds /stop parameter to stop processing on the first encountered error
if wildcards are used.
- Renames /quiet parameter to /silent.
May 12, 2005 - Version 1.05 (build 16.3)
- Adds /move parameter to delete the local file if the upload is
successful.
March 9, 2005 - Version 1.05 (build 15.3)
- Fixes: authentication on HTTP servers was not sent.
- Fixes: the host name was not correctly parsed if the path started with a
question mark.
- Fixes: a file name was not always appended to the URL when using wilcards.
- Fixes: *.* and * wildcards were not supported.
- Adds /noappend parameter to prevent the concatenation of a file name
to the URL even if it does not hold a file name.
September 22, 2004 - Version 1.04 (build 12.3)
- Adds /post parameter that allows you to upload a file using POST instead
of PUT. This option requires a script on the server side. A sample script
(post.asp) is provided in the zip.
- Adds /validate parameter which tests the path on a FTP server and creates
the missing folders and sub-folders.
August 25, 2004 - Version 1.03 (build 10.3)
- Fixes a little memory leak (handle not closed).
- Fixes some issues when adding a file name to the target URL.
- Adds ERRORLEVEL support.
- Adds /quiet parameter. No output at all but if the syntax is wrong.
July 31, 2004 - Version 1.02 (build 6.6)
- Simplifies command-line syntax.
- Some minor internal changes.
December 23, 2002 - Version 1.01 (build 4.1)
- Adds /del and /proxy parameters.
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