Problem with UXFileUpload

2 replies. Last post: August 31, 2011 10:02 PM by Jimmy Petrus
Tags :
  • New Discussion
  • New Question
  • New Product Feedback
ISOL TIMember
Hi,

 My problem with this control is as follows I'm doing an validation in the event UploadStarted when the validation is not met I want to cancel the file upload, I used the method CancelUpload (); without achieving the goal.

Is there any way we can do what I need?

Annex xaml code and xaml.cs

XAML
<Intersoft:UXFileUpload Grid.Row="4" Height="Auto" Width="250"
                                   Name="uploadCatalogo" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="12,12,12,12"
                                   ServiceUrl="http://localhost:16219/UXFileUploadHandler.ashx"
                                   TargetFolder="~/ClientBin/MyStorageFolder" OverwriteExistingFiles="True"
                                   TargetWebUrl="http://{host}/ClientBin/MyStorageFolder"
                                   MaxFileSize="204800000" Style="{StaticResource PhotoUploadStyle}"
                                   IsAutomaticUpload="True" CanSelectMultiple="False"
                                   ShowStatisticsOnCompleted="False" EnforceFileTypeValidation="True"
                                   FileTypeFilter="Portable Document Format (*.pdf)|*.pdf"
                                   UploadedFileUrl="{Binding preview, Mode=TwoWay, ValidatesOnDataErrors=True}"
                                   Visibility="Visible" FilesUploaded="uploadCatalogo_FilesUploaded"
                                   FilesUploading="uploadCatalogo_FilesUploading"
                                   FilesUploadFailed="uploadCatalogo_FilesUploadFailed"
                                   UploadCancelled="uploadCatalogo_UploadCancelled"
                                   UploadStarted="uploadCatalogo_UploadStarted" />


XAML.CS

private void uploadCatalogo_UploadStarted(object sender, Intersoft.Client.UI.Aqua.UXInput.UploadEventArgs e)
        {
            hastoUpload = true;
            string fileName = ((Intersoft.Client.UI.Aqua.UXInput.FileUploadInfo)uploadCatalogo.Items[0]).FileName;
            if (!IsAlphaNumeric(fileName))
            {
                ErrorCallOut.HorizontalOffset = -170;
                ErrorCallOut.VerticalOffset = 270;
                ErrorCallOut.Content = "No se permiten caracteres especiales como nombre de archivo.";
                ErrorCallOut.IsOpen = true;
                uploadCatalogo.CancelUpload();
            }
            else
            {
                isUploading = true;
            }
        }

 public bool IsAlphaNumeric(String strToCheck)
        {
            Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9' '_]");
            MatchCollection col = objAlphaNumericPattern.Matches(Path.GetFileNameWithoutExtension(strToCheck));
            if (col.Count > 0)
                return false;
            return true;
        }


Regards,


ISC. Carlos Ram?rez Guerrero
All times are GMT -5. The time now is 9:03 AM.
Previous Next