Components of Px Framework:
PxUploader - component for uploading binary and text files to the server
The PxUploader component secures uploading of binary or text files from a client browser to the server. The PxUploader works with browsers like Windows Internet Explorer, Firefox, etc.. For the correct functioning of the PxUploader component you need to have the JavaScript enabled and the Flash Media Player installed in your web browser.
If you want to work with the PxUploader component, you have to define it in the *. aspx file as follows:
<Prx:PxUploader ID="Uploader" runat="server" />
If you want the PxUploader component to be visible in the aspx files, define the "Prx" prefix related to the assembly of the PxUploader component in the header of the file. Do it as follows:
<%@ Register TagPrefix="Prx" Namespace="PxUploader" Assembly="PxUploader" %>
Then you can work with the PxUploader component in the *. aspx.cs file as follows. First, use the
UploadDir property to define in the PxUploader component the path to the directory where the files shall be stored.
Then enter to the
IdUploadFile property the file Id which shall be attached to the file name as a prefix for the better unique file identification.
The
MultiFiles property enables you to define whether one or several files can be selected for uploading to the server. More in the example below:
Uploader.UploadDir = @"uploads\data";
Uploader.IdUploadFile = 7777;
Uploader.MultiFiles = false;
The
FileDescription and
FileExt properties enable you to control definition of the filter in the OpenDialog form, where the file selection according to the file extension is carried out.
Uploader.FileDescription = "Image Files";
Uploader.FileExt = "*.jpg;*.png;*.gif;*.bmp;*.jpeg;*.zip;*.rar";
The
SizeLimit property serves for definition of the maximum file size in bytes, which can be uploaded to the server. The PxUploader component allows to upload files up 2GB to the server. For more information please refer to the example below, which with the current pre-set allows to upload a file with the maximum size of 10 MB:
Uploader.SizeLimit = 10485760;
The default file size that can be uploaded to the server, is set to 4MB in the IIS. This can be changed through the settings in the
web.config file, under the
<system.web> section in the
maxRequestLength property. See the example below:
<system.web>
<httpRuntime executionTimeout="110" maxRequestLength="2097151"
requestLengthDiskThreshold="80" useFullyQualifiedRedirectUrl="false"
minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="5000"
enableKernelOutputCache="true" enableVersionHeader="true"
requireRootedSaveAsPath="true" enable="true" shutdownTimeout="90"
delayNotificationTimeout="5" waitChangeNotification="0"
maxWaitChangeNotification="0" enableHeaderChecking="true"
sendCacheControlHeader="true" apartmentThreading="false"/>
</system.web>
If you want to upload files of 2GB to the server, in the IIS version 7, set the
maxAllowedContentLength property in the
<system.webServer> section of the
web.config file. Of course, it is necessary to remember to adjust the
SizeLimit property and set the 2GB size there. More in the example below:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2097151000" />
</requestFiltering>
</security>
</system.webServer>
The
ButtonText property allows to change the name of the button of the PxUploader component. More in the example below:
Uploader.ButtonText = "Add Files...";
The image of PxUploader component during the uploading of a file to the server looks like this, see picture below:
The PxUploader component events:
The PxUploader component generates two events. These are the
CompleteUpload and the
AllCompleteUpload events. The
CompleteUpload event is called in after the complete file uploading to the server directory, which was specified in the UploadDir property. The called in method body also contains the uploaded variables such as file name and file path where the file has been saved. The
AllCompleteUpload event is called in after the
CompleteUpload event, usually when all files have been uploaded to the server. Definition of individual events, and their linking to the methods shall be described, for more information please refer to the example below:
protected void Page_Load(object sender, EventArgs e)
{
Uploader.IdUploadFile = 7777;
Uploader.UploadDir = @"uploads\data";
Uploader.ButtonText = "Add Files...";
Uploader.CompleteUpload += new
PxUploader.CompleteUploadEventHandler(Uploader_CompleteUpload);
Uploader.AllCompleteUpload += new
PxUploader.AllCompleteUploadEventHandler(Uploader_AllCompleteUpload);
}
void Uploader_AllCompleteUpload(object sender, EventArgs e)
{
string a = "";
}
void Uploader_CompleteUpload(object sender, string FileName, string Path, EventArgs e)
{
string a = "";
}
Others articles of Px Framework:
- PxWebQuery - component for working with databases
- PxSuperGrid - component for the direct display of data in the table
- PxEdit - component for data editing, similar to the TextBox component
- PxComboBox - component for selecting data from a list, similar to the DropDownList component
- PxCheckBox - component for checking the value (Check / UnCheck value)
- PxFlyComboBox - set of the consecutively linked comboboxes, suitable for the work with structured data (for example: selection of category and subcategory)
- PxGreatRepeater - component for entering data with repeating structure, maximum number of values is limited
- PxJSDatePicker - component for the date entry, based on the JavaScript
- PxDbNavigator - the component for the work with the PxWebQuery components, row cursor movement, etc.
- PxLabel - component for data display
- PxCheckBoxList - component to view and select values from the list
- PxRadioButtonList - component for view and selection of a value from the list
- PxChart - the component for displaying and working with charts
- PxFilterView - visual component for filtering the table data contents in the PxWebQuery component
- PxUploader - component for uploading binary and text files to the server
- PxLogin - component for authorization and logging into the application
- Data loading from the Oracle, MSSQL, MySQL, FireBird, Interbase database by means of the PxWebQuery components
- Program inserting, editing or deleting of row into the database by means of the PxWebQuery component
- Loading values from the PxWebQuery component via the while cycle
- Row search in the PxWebQuery component according to the value entered and the name of the column where the search shall be carried out
- The "ReOpen" procedure of the PxWebQuery component and data re-load into the PxWebQuery component
- Validation, checking of the entered values by means of the PxWebQuery component and other visual components (PxEdit, PxComboBox, etc.)
- Events of the PxWebQuery component
- A special function GetValueFromStructKey of the PxWebQuery component
- Setting the language mutation of the Px Framework
- Finding the current version of the Px Framework
It doesn't the intention of this part website, describe in detail the work with PxFramework components, a detailed description of the component
available in manual, which can be downloaded here:
Download manual of Px Framework