Browser Tries to Download index.php Instead of PDF

A place for users and developers of the Xataface to discuss and receive support.

Postby moj0rising » Fri Feb 02, 2007 12:43 pm

When a user tries to download a PDF file uploaded to a given record, they get index.php instead of the attached PDF file.

I have followed the documentation on implementing PDF uploads (http://framework.weblite.ca/documentation/how-to/how-to-handle-file-uploads/?searchterm=pdf) and verified I did so correctly.

This issue occurs in Firefox and Internet Explorer but not Konqueror (I suspect it works fine in Safari since that one is Konqueror/ KHTML based).

Thank you!

Mike
moj0rising
 
Posts: 26
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Fri Feb 02, 2007 1:05 pm

Are you storing the PDF file in the database or on the filesystem?Ê Can you provide some details about your fields.ini file and your table schema so I can see what is going on there?

--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby moj0rising » Fri Feb 02, 2007 1:16 pm

The file is stored in the database.

[Manufacturer]
widget:type = select
vocabulary = Manufacturer
order = 1

[Version]
widget:label = "Version/ID"
order = 2

[Jurisdiction]
widget:type = checkbox
vocabulary = Jurisdiction
repeat = 1
order = 3

[GameName]
widget:label = "Game_Name"
order = 4

[MediaType]
widget:label = "Media_Type"
widget:type = select
vocabulary = Media Type
group = media
order = 5

[MediaCategory]
widget:label = "Media Category"
widget:type = select
vocabulary = Media Category
visibility:list = hidden
visibility:browse = hidden
group = media
order = 6

[MediaSize]
widget:label = "Media_Size"
group = media
order = 7

[Position]
widget:label = "Position"
visibility:list = hidden
group = media
order = 8

[Function]
group = media
order = 9

[Kobetron]
widget:label = "Kobetron"
group = signature
order = 10

[Dataman]
widget:label = "Dataman"
group = signature
order = 11

[SHA]
widget:label = "SHA-1"
group = signature
order = 12

[OtherSig]
widget:label = "Other_Signature"
visibility:list = hidden
group = signature
order = 13

[ReplaceWith]
widget:label = "Replace_With"
widget:description = "(for obsolete or revoked items)"
order = 14

[ReportNumber]
widget:label = "Report#"
order = 15

[FileNumber]
widget:label = "File#"
order = 16

[Status]
widget:type = select
visibility:list = hidden
vocabulary = Status
order = 17

[For]
widget:type = select
vocabulary = Compliance Certification For
visibility:list = hidden
order = 18

[CertificationIssued]
widget:label = "Certification_Issued"
visibility:list = hidden
order = 19

[CertificationLetter]
widget:label = "Certification_Letter"
visibility:list = hidden
order = 20

[CertificationLetter_mimetype]
visibility:list = hidden
visibility:browse = hidden
order = 21

[CertificationLetter_filename]
visibility:list = hidden
visibility:browse = hidden
order = 22

[Comments]
widget:label = "Comments"
visibility:list = hidden
order = 23

[RecordNumber]
widget:label = "Record#"
order = 24

[Increment]
visibility:list = hidden
visibility:browse = hidden
order = 25

Here is a screenshot of my database tables in phpmyadmin:
http://70.98.54.35/~bmmcom/screenshots/database.jpg

The site is at
http://70.98.54.35/~bmmcom/torpedo

A user ID is nevada with a password of dataface.

Mike
moj0rising
 
Posts: 26
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Fri Feb 02, 2007 4:56 pm

It's been a while since I've stored binary in a database so I had to check up some old samples.Ê What is happening isn't major (IMHO).ÊÊ It just calls the file index.php, but it is still the correct mimetype and you should be able to download it and open it correctly if you choose "Open with..." in windows and choose the correct app.

The reason it is doing this is because Dataface is not including the Content-disposition HTTP header with the file name.Ê I have updated my development version to include this header now so the next release will result in the correct file names showing up.


Best regards


Steve

--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby moj0rising » Fri Feb 02, 2007 5:35 pm

Can you clarify on the "Open with" bit? I tried right-clicking and then "Save as" with no luck in both browsers (in Firefox it's "Save Link As").

Mike
moj0rising
 
Posts: 26
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Fri Feb 02, 2007 5:49 pm

If you just click the link, it should try to download the file.Ê Simply save this file somewhere on your computer, then right click it (and choose "Open with..." and select the application that should be used to open it.Ê If this is really a problem for you guys I can send over the changes that produces the correct file name - when I get time.



-Steve

--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby moj0rising » Fri Feb 02, 2007 6:03 pm

That isn't working :(

Can we have those changes when you get a minute or two?

Mike
moj0rising
 
Posts: 26
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Sat Feb 03, 2007 1:44 am

--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby moj0rising » Mon Feb 05, 2007 4:59 pm

Thanks for the patch!

The problem now is that the file name is still index.php (not sure about before) and if you rename the file after downloading, a PDF application can open it with no problems.

How can we get it to preserve the file name?

Thanks,
Mike
moj0rising
 
Posts: 26
Joined: Wed Dec 31, 1969 5:00 pm

Postby moj0rising » Mon Feb 05, 2007 5:47 pm

Scratch that last post. I thought I would try re-downloading the patch and ftp'ing again. I guess something went wrong, or maybe I even forgot to upload the patch. At any rate, it is working properly now with firefox and I'm sure it will work the same with IE but I better check.


Thanks again,

Mike
moj0rising
 
Posts: 26
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 19 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved