digital.forest Technical Support
Lasso Professional File Upload Basics

Before you can use the file upload features built into Lasso Pro, there are a few important steps you need to take in order to adapt your solution to our shared server.

  • You must be using a virtual host "eg, www.mydomain.com" rather than a standard testing url (such as host.forest.net/~yourusername/) We can set up a staging domain for customers who are still testing and programming their sites -- just ask!
  • Staff will need to create a symbolic link to /var/tmp (which is where all Lasso files are initially uploaded to) in the root directory of your virtual host. This allows you to access uploaded files without us having to allow access outside of your root directory. We generally create this shortcut when we set up your account -- look for a file called /tmplink at the root of your Sites directory. If you do not see a tmplink file, contact our staff to have the link created.

Next, be sure to first configure File Tags security in the Lasso Manager. If you haven't already, create a security group. Take note of the group administrator name and password, as you'll need it later for your code.

In the "Security: File Tags" area of Lasso Manager, enable the appropriate file tags for your group. Permissions needed for file uploads might typically include create, move, copy, delete, and import. If you're just starting out or testing, you may want to enable all permissions.

You'll want to surround any lasso file tags with an [inline] specifying the group administrator name and password.

For example, if I've created a group named "fileaccess" with a group administrator username and password of "master" and "test" respectively and assigned all permissions, I would then modify my upload page as follows:

[inline: -username='master',-password='test'] ..file tag operations here... [/inline]

Some scripts are pre-programmed to let you specify a name and password for the file tags, generally stored in variables near the top of the file.

Finally, you will generally have a key line of code in your page where Lasso gets the "upload.name" attribute of the uploaded file and sets it to a variable (in this case, 'TempFilePath'), like the example shown below:

[Variable:'TempFilePath'=(File_Uploads -Get:(Loop_Count)->Find:'upload.name')]

Locate this line in your upload script and add the following line of code after:

[var: 'TempFilePath' = (string_replace: (var: 'TempFilePath'), -Find='///var/tmp',-Replace='/tmplink')]

It is important to add the above line of code DIRECTLY BELOW the line where upload.name is set to a variable, as shown above.

Note: Replace both instances of var: 'TempFilePath' in our sample code with the name of the variable your code uses. Be sure to change the variable on both sides of the equal sign