-
//if the the user is uploading file then process it
-
if (len(form.uploadFile))
-
{
-
//create resize object
-
variables.imgObj = createObject("component", "dl_com.tmt_img");
-
-
//remove current file, if present in the form
-
if (len(form.currentPhoto))
-
{
-
//remove exisiting photo if present
-
variables.functionFile.removeFile (
-
fileName = form.currentPhoto,
-
filePath = application.event.fullFilePath
-
);
-
}
-
//upload new file
-
variables.newFile = variables.functionFile.uploadFile (
-
destination = application.orgFilePath,
-
fileField = "form.uploadFile",
-
acceptType = 'image/gif,image/jpg,image/jpeg,image/pjpeg',
-
nameConflict = 'makeunique'
-
);
-
-
//name the new file
-
variables.fileName = 'propertyEvent' & '_' & randRange(1000,2000) & Right(variables.newFile,4);
-
//resize image and copy image to permanent location
-
variables.imgObj.resize (
-
source = application.orgFilePath & variables.newFile,
-
destination = application.event.fullFilePath & variables.fileName,
-
newWidth = application.event.fullSize
-
);
-
-
//remove original photo
-
variables.functionFile.removeFile (
-
fileName = variables.newFile,
-
filePath = application.orgFilePath
-
);
-
-
//set the file name for the bean
-
variables.beanEvent.setEventPhoto(variables.fileName);
-
}