A note on recursive upload of files and folders.
As you would have seen from the demo, the applet can upload
not just files but entire directory trees as well. These recursive uploads can be treated just as any
other file transfer. However if you wish to recreate a directory tree on the
server similiar to what may have existed on the user's computer this article may prove usefull.
With HTTP and HTTPS
Make use of the full_path setting of the applet to ensure that the full (absolute) pathname of each file is sent to the server. The first step in creating the folder tree is to convert these absolute paths to relative paths. The second step is to strip out their common components. The userfile_parent parameter passed by the applet to the script on the server is a usefull aid in this task. userfile_parent is the parent folder for all the files and folders that were uploaded.
With PHP handlers
You might feel that PHP may not the be the best option because of recent versions of the PHP engine
completely removes the path information of uploaded files. With Rad Upload it's quite easy sift the full path
through this filter. How do you do it? with the encode_path setting of the applet.
The encode_path which was introduced in version 1.31, directs the applet
to urlencode the name of each file there by preventing the PHP engine from stripping out path information. It is
a simple matter to urldecode them to their original format (with the aid of the PHP urldecode() function).
encode_url supersedes the translate_path parameter introduced in version 1.19 rel 2, but you
can still make use of translate_path setting if you wish to convert a windows pathname to a unix pathname. In other words to replace all occurrences of the '\' character with the '/' character.
|If you look at our online demo you will find that posting
acceptor is indeed a PHP script. A quick glance toward the screen shot on your left reveals that
it can display absolute paths.
A variation of this same script is included
in the download bundle. The examples page includes alternatives in perl and JSP as well.
With J2EE or perl
J2EE and perl also provide easy access to the full path name.
The absolute path name will be passed to your serverside handler for each file that's uploaded. Unlike PHP you will find that the path information is preserved even when it contains the '\' character. A with the PHP handler you can make use of the userfile_parent to convert these pathnames to relative paths.
A sample perl script is included in the download while a sample JSP is available on this site.
See the examples page
The more interactive nature of the File Transfer Protocol means the built in FTP client of Rad Upload Plus or standard edition to automatically create the directory tree on the server. As a result you do not need to make any configuration changes provided the ftp server user account has sufficient permissions.