FileDialog problems on WebClient

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Active user
1C:Professional
Rating: 3
Joined: Dec 4, 2015
Company: Smart ID Dynamics

Hello,

I have problems with FileDialog on WebClient using Chrome or Mozilla browsers.
Although FileSystemExtension is installed, after file selection, the file cannot be processed because it cannot be found. That means it was not sent to server.

1c:Enterprise platform version tested: 8.3.8.2322, 8.3.9.2033.

Is there any solution to my problem?

 
#2
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Nov 24, 2011
Company:

Hello. Maybe this code helps U:

Code
&OnClient
Procedure ChoosingFileProcessing(FileName, Parameters) Export
    If FileName<>Undefined Then
        Object.FileName = AdditionalObjects.GetFileName(FileName);
        
        #If Not WebClient Then 

            Digdata = New BinaryData(FileName);
            SendFileToServer(BinaryData);
        #Else

            SendingFiles = New Array;
            SendingFiles.Add(New TransferableFileDescription(FileName, ""));
            SendedFiles = New Array;
            If Not SendFiles(SendingFiles, SendedFiles, , 
                                        False, UUID) Then
                Message("Error sending file: " + ErrorDescription());    
            Else
                SendFileToServer(SendedFiles, True);
              EndIf;    
        #EndIf                                                                 

    EndIf;    
EndProcedure

&OnServer
Procedure SendFileToServer(Datas, CalledFromWeb = False)        
    If CalledFromWeb Then
        FileAddress = Datas[0].Location;
        BinaryData = GetFromTempStorage(FileAddress);
    Else
        BinaryData = Datas;
    EndIf;

    Obj = FormAttributeToValue("Object");
    Obj.Storage = New ValueStorage(BinaryData);
    Obj.Size = BinaryData.Size();
    If Not ValueIsFilled(Obj.Description) Then 
        Obj.Description = Obj.FileName;
    EndIf;        
    Obj.AddingDate = CurrentDate();
    Obj.Write();
    ValueToFormAttribute(Obj, "Object");                   
EndProcedure

Edited: Anatoly Lukyanov - May 19, 2017 05:19 AM
 
#3
People who like this:0Yes/0No
Active user
1C:Professional
Rating: 3
Joined: Dec 4, 2015
Company: Smart ID Dynamics

Thank you!
I managed to do it using BeginRead() function from TextDocument. I used a notify description and now there are no problems in Chrome, Mozilla and IE.

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.