Pure ASP Upload Tutorials - Upload to variable folder
Upload to variable folder
In this tutorial we will explain how to do a file upload to a folder that is chosen dynamically. This mean that your folder name can vary. An example of this is when you want to have the user name as a folder name.
How to do it
To make the file upload to a variable folder, you need to:
- Start with basic upload page
Start with an upload page where you have Pure ASP Upload on it. If you haven't done it yet, go through the Simple file upload tutorial.
- Open the Pure ASP Upload dialog
Select the Pure ASP Upload dialog by double clicking it on the Sever behaviors list.
- Choose the variable folder
- Save and done
When you need to use a variable folder, you can enter any expression you want in the Upload Folder field. For example if I have a Session variable that has the user login in it, I could write:
"Upload/" & Session("Login")
this will create a new directory for every user that tries to upload! Non existent folders will be auto-created so this is really powerful! You only need to setup the security on the main Upload folder, for more info how to do this read the Setting the folder security on your server tutorial.
You might also check the Prefix With Full Path option. This option will store the full path in your database (if you are saving the filename in a database). So it will be easy to retrieve a list of all files later on.
Save your page and upload it to your server, and you are done! Go to your website and test it - you should be able to upload any file to a dynamic folder.
George Petrov is a renowned software writer and developer whose extensive skills brought numerous extensions, articles and knowledge to the DMXzone- the online community for professional Adobe Dreamweaver users. His expertise in countless languages and technologies gives inspiration and teach valuable lessons on his website – DMXzone.com which is most popular for its over high-quality Dreamweaver extensions and templates.