Uploadify allows an easy upload of files from GeneXus web applications. We can define the extensions of the files that need to be uploaded, set the maximum size of files to upload and simultaneously upload multiple files. The files we select can be stored in the database in Blob type field. Following are the simple steps to use this control.
1.
Install the User Control from GeneXus Marketplace and restart
GeneXus. http://marketplace.genexus.com/product.aspx?uploadify,en
2.
Drag and drop the Uploadify control from Toolbox under Misc.
List on the Web Panel. With this, it provides an example in events section.
Event
Uploadify1.OnAllComplete
for &File in &UploadedFiles
msg(&File.OriginalFileName)
endfor
EndEvent
Event
Uploadify1.OnCancel
&File = Uploadify1.File
msg("Cancel:" + &File.OriginalFileName)
EndEvent
Event
Uploadify1.OnError
&File = Uploadify1.File
msg("Error uploading file:" + &File.OriginalFileName)
msg(Uploadify1.Error)
EndEvent
3.
After
a successful upload, OnAllComplete event would be triggered. The events such as
OnCancel, OnError, OnComplete, OnSelect and OnSelectOnce are available with the
control.
4.
The
Size upload limit and simultaneous upload limit can be set through properties. These
properties can be changed and validated during runtime too.
5.
During
the file upload and it’s insertion in the database (as blob entry), the
uploaded file gets stored at the PublicTempStorage directory at KB installation
location. For a java web application, it gets created at - C:\Program Files
(x86)\Apache Software Foundation\Tomcat 7.0\webapps \<KBName>KBJavaEnvironment
6.
To
save the uploaded file in the database, we need to use the temporal full path
to a blob variable.
&blob
= &UploadedFile.TemporalFileName
If we are using this user control in a java web application,
we must include the following files in war for WebSphere deployment.
- upload.jar file in WEB-INF\lib\ location
- drivers folder structure at WEB-INF\lib\