+ Start a Discussion
davecrusodavecruso 

Object__c Attachment: Downloadable on PreProd Sites, but not on Prod Sites

Hi all, 

 

We've just migrated our application from Preproduction to Production on our sites deployment. One of the objects, "Apprenticeship", provides the ability for Guest users to upload, download and remove files. 

 

Guest users can upload and remove files, but can't download the files - which worked on Preproduction, but doesn't seem to work on Production.

 

The error comes when the Guest user tries to access the file/download servlet located on the FILES tab. Compare:

 

This site is working: http://citizenschools.preprod.cs2.force.com/lessons/CTN_Apprenticeship?id=a0GR000000190tPMAQ&ctContactId=003R000000Ea03n

 

And this site is not: http://citizenschools.force.com/lessonplanning/CTN_Apprenticeship?id=a0G40000000uIMGEA2&ctContactId=0034000000YTrDKAA1

 

... despite that the Custom Object has read/edit permission set & that there are no other apparent differences between objects and sites. 

 

Any suggestions about how to resolve? Other information needed to figure it out? Thanks SO MUCH for your help!

 

--Dave

 

Message Edited by davecruso on 08-14-2009 12:57 PM
Best Answer chosen by Admin (Salesforce Developers) 
BulentBulent

the link to download files looks like (na6.salesforce.com.....) this is not your site url. I am guessing you are hardconding some part of the url.

you need to use the proper visualforce method to generate the link url so that it'll use the site url rather than na6.salesforce.com 

 

example

 

{!URLFOR($Action.Attachment.Download, attachment.Id)}

 

 

 

Message Edited by Bulent on 08-19-2009 09:42 AM

All Answers

davecrusodavecruso

If it helps figure it out, we have:

 

* Confirmed that the object permissions for Apprenticeships__c are set to read/edit for Guest

* Confirmed that the correct information is being written to the object (it is)

* Confirmed that the issue is only on Production (it is)

* Confirmed that the issue is only with reading from the File.Download script (it is)

* Confirmed that the file's IsPrivate flag is set to false (they are) 

 

So, any assistance identifying with the Sites Guest user can't read through that particular script would be great! Some questions include:

 

* Does the Sites Guest user need to load some kind of permission-based view to download the file?

* Does the Sites Guest user need to load some kind of permission-based script to view the file?

* Why does the issue not happen on our pre-production server, but why on our production server?

 

 

davecrusodavecruso
Ping -- still trying to figure through this issue. Any suggestions? Has anyone else had this issue yet, with Site Guest users download Attachments from Notes and Attachments?
BulentBulent

the link to download files looks like (na6.salesforce.com.....) this is not your site url. I am guessing you are hardconding some part of the url.

you need to use the proper visualforce method to generate the link url so that it'll use the site url rather than na6.salesforce.com 

 

example

 

{!URLFOR($Action.Attachment.Download, attachment.Id)}

 

 

 

Message Edited by Bulent on 08-19-2009 09:42 AM
This was selected as the best answer
davecrusodavecruso

Yay for Bulent! Once again, you have helped to solve the problem. Thanks for your incredible helpfulness with Sites, 

--Dave