close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Download behavior is corrupting files

Thread began 1/04/2019 11:19 am by Mags | Last modified 1/04/2019 2:25 pm by Ray Borduin | 477 views | 4 replies |

Mags

Download behavior is corrupting files

I have some download behaviors on a site which worked OK when I was using mySQL, but now that the site is running mySQLi it seems that the document encoding on Word, Excel files etc is becoming corrupted during the download process. The original files are fine and if I grab the uploaded files from the server, these are also fine. But when I use the download behavior to download the files, it will download OK but when I try to open it I either get an error message saying the file is corrupt and can't be opened, or it will attempt to open it but Word asks me to select the correct encoding and whatever type I choose, it won't open properly.

An example behavior would be:

<?php
WA_DFP_SetupDownloadStatusStruct("WA_DownloadResult1");
if(isset($_POST["download"]) || isset($_POST["download_x"])){
WA_DFP_DownloadFile("WA_DownloadResult1", "/downloads/", "".((isset($_POST["hiddenfield"]))?$_POST["hiddenfield"]:"") ."", "".((isset($_POST["hiddenname"]))?$_POST["hiddenname"]:"") ."", false, false, false, "", "", "", "");
}?>

<form method="post" action="" id="<?php echo $rsAppendicesIMPGI->getColumnVal("ID"); ?>" name="<?php echo $rsAppendicesIMPGI->getColumnVal("ID"); ?>">
<input name="hiddenfield" type="hidden" id="hiddenfield" value="<?php echo($rsAppendicesIMPGI->getColumnVal("Link")); ?>">
<input name="hiddenname" type="hidden" id="hiddenname" value="<?php echo($rsAppendicesIMPGI->getColumnVal("Title")); ?>">
<button type="submit" name="download" class="btn btn-primary"><i class="fal fa-download"></i></button>
</form>

I've attached an example of a downloaded file so that you can see what happens to it.

Sign in to reply to this post

Ray BorduinWebAssist

If you have a blank line of code before the download code that can cause the corruption. I'd need a copy of the page to track it down, but that is usually the issue when someone reports problems like this. The download code hasn't changed at all from Databridge v1 to v2 and it doesn't use MySQL code at all either, so that isn't the cause.

I'm guessing you have a blank line or other characters in the code on the page. If you want to give me FTP access I can help you track it down.

Sign in to reply to this post
Did this help? Tips are appreciated...

Mags

Hi Ray

I don't seem to have a blank line before the download behavior, FTP details are in the PM.

Sign in to reply to this post

Ray BorduinWebAssist

There are blank lines on line 2 and line 5 of test.php.

Sign in to reply to this post
Did this help? Tips are appreciated...

Mags

Removed the blank lines and it now works - thanks!

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...