Hi, I'm using Chronoforms V5 and I'm getting corrupted files when using the download action. I've tested with pdf and jpg so far, and it happens in all browsers I've checked (FF, IE, Chrome) as well as on other people's computers using different ISPs.
It originally happened on a complicated multi-page form, but I created a new form with just a download button and action, and I'm getting the same results. The files are fine on the server and open fine via ftp. When I use the form to download a 1.6MB pdf, the firefox download cue shows the file size correctly, but when it reaches my desktop, the file is only 4KB and I get the message "The root object is missing or invalid" in Acrobat. When I download a jpg, Photoshop doesn't recognize the file.
I tested with a couple of PHP download scripts (Smart File Download and PHP Easy downloader), and the files download and open fine using those scripts. Any ideas what the problem could be?
Hi stepd,
I've no real idea, and haven't' seen this reported before in the forums here.
I wonder what is being downloaded - please look at the 4kb file in a text editor and see what the contents are - I am guessing that they may be the HTML content of the page instead of the file.
Bob
I forgot to mention that I did actually open the pdf file in a text editor, and it does have binary info in it. Looks like the beginning of a pdf header then has about 50 null lines. I'll try to attach it as a text file to this post.
Hi stepd,
Hmm - the file looks a bit like a PDF but clearly is missing most of the content. Hard to know what is happening. Please post a link to the form so I can take a quick look.
Bob
To remove distractions, here's a stripped down page with just a form with a submit button:
http://pffc-online.com/downloadtest
Hi stepd,
I tried to look but the site is giving me "Database connection error (2): Could not connect to MySQL."
Bob
You probably just happened to check during a run of indexer bots. That error can appear on occasion if a bunch of them hit the site at the same time (thousands of articles on the site). The site is hosted on a VPS at inmotion. Unfortunately, not related to the download problem.
Hi stepd,
Sorry, no bright ideas here. I see the same as you - the full file size shows, then the download is cut off.
Does it work if you create a download link and show that instead of the immediate download?
Bob
Yeah, it's definitely strange. Pretty much everything else I've tried works (direct links, external third-party php scripts, etc.). There must be some kind of problematic interaction between the Chronoforms download action and the way this particular server is set up or something. On the original form, I just ended up using the hidden iframe trick where the user clicks the button, javascript changes the iframe source to an external php script (Smart File Download) with the file name appended to the URL, and that script forces the save as dialog in the browser. It's a roundabout way of doing it, but at least it's working. The main thing is, I don't want the location of the file to be obvious to the user since they have to fill out a form first to download the file, so using a form action that doesn't expose the file folder In the page source is important.
I'm curious if you ever found an answer to this? I'm having almost the exact same problems with a PDF file on my site. I can view the PDF in the browser if I link to it, and I can e-mail the file to myself and open it just fine, but if I download it, it says the file is corrupt.
You can access the form at http://www.ministermatch.com/congregations/guided-search and just fill out the "Ready to Learn More" form on the right hand side.
The PDF file was generated out of Apple Pages. I have both tried version of the file that were exported to PDF and versions that were "printed" to PDF using the built in Mac save to PDF function on the print screen.
What do you have in the setup section before the "Download" action ?
Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Hi Max,
On Load
Load Captcha
HTML (Render Form)
On Submit
Check Captcha
On Success (blank)
On Fail
Event Loop
Handle Arrays
Custom Code (Sets the Email and Linked File)
Email (to the admin)
Email (to the user with a copy of the file set in Custom Code)
Event Loop (calls On D1)
On D1
HTML (Render Form) - Loads Thank you screen with link for download button and a link to open the file directly in browser (based on the custom code above).
When the download button is clicked it calls D2.
On D2
File Download
Process wise, everything seems to work fine. I get the PDF in the e-mail and can open it. I can click the link on the D1 screen to open the PDF in the browser. I can click the link for the download button and the file downloads but shows up as corrupt.
In all 3 delivery methods, I'm pulling the same file from the same source.
I'm running this on ChronoForms 5 on a Joomla 3.4 server.
Try to add this to the D2 link:
&tvout=ajax
Does it help ? if not then please copy and paste the full link to D2 here, the one used in the download button!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
How do you have the download button set up ? is it a "link" to the D2 event or its a submit button ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
The Button on D2 is setup as a submit button.
The D1 HTML form is Form Method: File; AJAX Submit: No
I tried changing the AJAX Submit type to "yes" while spending the &tvout=ajax to the url but that didn't seem to work either.
Don
Hi Don,
No, AJAX will not work here.
We need a link to test the download event, which is the form link + "&event=D2&tvout=ajax"
Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Sorry Max,
I'm not sure what you are asking me to do. I created a manual link on the D1 thank you page called "test" that links to "href=images/documents/7GreatMythsAboutSearchFirms.pdf&event=D2&tvout=ajax" but that doesn't seem to trigger the download event... What am I missing?
What's the link to your form ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
The link to the form is http://www.ministermatch.com/congregations/guided-search (it is the "ready to learn more form on the right hand side"
Ok, this is the link executing the D2 event:
http://www.ministermatch.com/index.php?option=com_chronoforms5&chronoform=7MostCommonMythsAboutSearchFirms&event=D2
but it returns nothing, which means that your "D2" event doesn't exist or is not configured correctly or maybe the file was not found.
Please check that or post a screenshot for the setup section in your form!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Hi MinMatch,
I also noticed that your form name starts with a 7 - that may be causing problems; please try changing it to start with a letter.
The name may be used as a variable name in PHP and they can't start with digits.
Bob
Ok, its "d2", please try this link after updating the form name:
http://www.ministermatch.com/index.php?option=com_chronoforms5&chronoform=7MostCommonMythsAboutSearchFirms&event=d2
Does it work ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Hi Max,
I put the link that you showed above on Page 2 of my form (the thank you page) and it works fine. The file downloads and is not corrupt. When I click the "download" button that triggers the Chronoforms file download action, the file is corrupt and has that extra content that i mentioned in an earlier post.
Please advise on the best way to resolve.
Just use the link, you can style it to look like a button this way:
<a class="btn btn-success" href="link goes here">Download</a>
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.