dibello.4
dibello.4

Reputation: 1

I have a website which pulls files from aws as .docx files but when they download they are .doc

I have a website which pulls files from aws as .docx files but when they download they are .doc. They have to be downloaded as .docx. I am baffled by this. The application uses "DownloadS3File" and AWSSDK.core and AWSSDK.S3. This is part of an ASP.NET web app. Does anyone know how to get the files to download as .docx?

  $.ajax({
        type: "POST",
        url: "../_layouts/idec_rrus/dlS3File.aspx",
        dataType: "html",
        data: "fileName=" + escape(fileName) + "&fileExt=" + escape(fileExt) + "&regID=" + escape(regID) + "&regName=" + escape(regName) + "&regType=" + escape(regType) + "&entType=" + escape(entType) + "&fileId=" + escape(fileId),
      success: function (url) {
            var iframe = document.createElement("iframe");
            iframe.src = url;
            iframe.style.display = "none";
            document.body.appendChild(iframe);
            document.body.document.body.appendChild(iframe);
        },
        error: function () {
            alert("An problem was encountered while trying to download the requested file.");
        }
    });
}

Public Shared Function DownloadS3File(ByVal filePath As String, ByVal fileName As String, ByRef wasSuccessful As Boolean) As String

    Dim chain As CredentialProfileStoreChain = New CredentialProfileStoreChain("C:\Aws\.aws\credentials")
    Dim awsCredentials As AWSCredentials

    If chain.TryGetAWSCredentials("lifebackup-profile", awsCredentials) Then
        client = New AmazonS3Client(awsCredentials, bucketRegion)
    End If

    Dim resultUri As String = GetSignedFileUri(filePath, fileName)

    If (resultUri.Length > 10) Then
        wasSuccessful = True
    End If

    Return resultUri

End Function

enter image description here

Tried downloading .docx file but it downloads as .doc.

Upvotes: 0

Views: 28

Answers (0)

Related Questions