uploadwindow.lzx
<library>
<class name="uploadwindow" extends="windowpanel" width="370" height="180" closeable="true">
<attribute name="uploadurl" value="
" type="string"/>
<attribute name="isOnlyImage" value="false
" type="boolean"/>
<attribute name="isOnlyPpt" value="false
" type="boolean"/>
<fileupload name="myFileUpload" isOnlyImage="${ this.parent.isOnlyImage }" isOnlyPpt="${ this.parent.isOnlyPpt }" isOnlyMP3="${ this.parent.isOnlyMP3 }">
<method name="onProgress" args="fr, bytesLoaded, bytesTotal">
this.parent.progressBar.setValue(bytesLoaded * 100 / bytesTotal);
if (Math.round(bytesLoaded * 100 / bytesTotal)==100){
this.parent.progressBar.setAttribute('visible',false);
this.parent.progressBar.setValue(0);
this.parent.txtFile.setText();
this.parent.browse.setAttribute("visible", true);
this.parent.close();
}
</method>
<method name="onHTTPError" args="fr, httpError">
Debug.write('onHTTPError invoked: ' + httpError);
</method>
<method name="onSelect" args="fr">
Debug.write("onSelect: ",getName());
this.parent.txtFile.setText(getName());
this.parent.upload.setAttribute('visible', true);
this.parent.browse.setAttribute('visible', false);
</method>
</fileupload>
<button fontsize="12" name="browse" x="130" y="75" text="Browse" width="200" height="20">
<handler name="onclick">
parent.myFileUpload.browse();
</handler>
</button>
<view resource="upload.png" x="0" y="5"/>
<text fontstyle="bold" x="130" fontsize="12" y="10" width="200">Filename:</text>
<edittext x="130" fontsize="12" y="35" width="200" name="txtFile" enabled="false"/>
<button name="upload" x="130" y="75" text="Upload" width="200" visible="false" height="20">
<handler name="onclick">
// path and Name of the Upload-Handler may vary !!
parent.myFileUpload.upload(parent.uploadurl);
this.parent.upload.setAttribute('visible', false);
this.parent.progressBar.setAttribute('visible', true);
</handler>
</button>
<view name="progressBar" visible="false" x="130" y="75" width="200" height="20" bgcolor="#C6CEDF">
<view x="1" y="1" width="198" height="18" bgcolor="#FFFFFF"/>
<view name="status" x="1" y="1" height="18" bgcolor="#D6DEEF"/>
<method name="setValue" args="value">
status.setAttribute('width', value * 198 / 100);
percent.setText(Math.round(value) + '%');
</method>
<text name="percent" align="center" resize="true" y="2" fontstyle="bold" fontsize="10" fgcolor="#555555"/>
</view>
</class>
</library>