Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Create a document type with upload a file View modes: 
User avatar
Member
Member
dinethnipuna-gmail - 11/17/2013 11:24:43 PM
   
Create a document type with upload a file
Hi,
I want to create a document type with a document/image upload option.
I have test direct uploader and upload file options ,but these two option only allow me to directly upload a document via from my pc.
What I want to do is restrict user to up load all the document via only the kentico Media library.
Can someone please help me with this.
Thanks.

User avatar
Member
Member
dinethnipuna-gmail - 11/18/2013 12:02:27 AM
   
RE:Create a document type with upload a file
I forgot to tell , I have tried form control "Media Selection" , but I can not use this as this field is a link to the uploaded document and once user clicks on the link they will be able to download the document. But when I use a "Media Selection" it doesn't allow me to do so. It gave me following error.
HTTP Error 404.0 - Not Found

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

Detailed Error Information
Module
ManagedPipelineHandler

Notification
ExecuteRequestHandler

Handler
PageHandlerFactory-Integrated-4.0

Error Code
0x00000000


Requested URL
http://localhost:80/KenticoCMS7/CMSPages/getfile.aspx?filename=test1111&aliaspath=%2f00000000-0000-0000-0000-000000000000

Physical Path
C:\inetpub\wwwroot\KenticoCMS7\CMSPages\getfile.aspx

Logon Method
Forms

Logon User
administrator

User avatar
Certified Developer 12
Certified Developer 12
chetan2309-gmail - 11/18/2013 7:04:34 PM
   
RE:Create a document type with upload a file
In your document type..go to section "Field Appearance" there you will find "Form Control". You can select "Media Selection". This will ensure the images that can be added are only from your media library.

Does it solve your purpose?

Thanks,
Chetan

User avatar
Member
Member
dinethnipuna-gmail - 11/19/2013 9:18:30 PM
   
RE:Create a document type with upload a file
Hi Chetan,

Thank you for your reply. As I mentioned I have test this option as well but when I do that user cannot download the document as it give an error as I mentioned on my post.
I need something like attribute type is file and Form control is Upload file or direct upload.
Thanks.

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 11/26/2013 5:04:39 AM
   
RE:Create a document type with upload a file
Hi,

Thank you for your message.

Media selection is the correct way of achieving your goal. There has to be something bad within the transformation or somewhere else.

If you create a form control Media selection you are able to successfully add an image out of the Media library to the document type is that correct? Can you see corectly those files in the Form tab?

How are you displaying the links? Can you compary the link in the media library of given file with the one you are giving to users?

To resolve your issue we would need to know these kind of information, so please let us know how it works in your case.

Kind regards,
Richard Sustek

User avatar
Member
Member
dinethnipuna-gmail - 11/26/2013 6:41:08 PM
   
RE:Create a document type with upload a file
Hi Richard,
Thank you for your reply.

As I mentioned I have tried with media library selection and used following code in my repeater transformation
<tr>
<td>Link to PDF: <a href="<%# GetFileUrl("PDF") %>">Download PDF</a></td>
</tr>

then I m getting the error.
But if I used file upload option this code will work without issue, the only issue is file upload does allow only to load document from desk top not from the media library.

Thanks.

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 11/27/2013 3:28:23 AM
   
RE:Create a document type with upload a file
Hi,

If you look in database you could see that we are saving path to the PDF file and therefore you can adjust your transformation for something like this:
<a href="<%# Eval("PDF")%>"><%# Eval("PDF")%></a>

I tested this code and it seems to work correctly :-)

Can you try it? How does it work?

Kind regards,
Richard Sustek

User avatar
Member
Member
dinethnipuna-gmail - 11/27/2013 5:59:44 PM
   
RE:Create a document type with upload a file
Hi Richard,
Thank you fro your reply , That is working ok. Thanks.
But the document is opening on the web page rather than allow to download it.
Actually what I want it when the user click on the PDF link it should allow them to download the document rather than showing on the page.

Also I have opened another discussion on the following link could you please check the following link and reply to me , much appreciated your help.

http://devnet.kentico.com/Forums/f65/t42045/Opening-Blizform-in-visual-studio.aspx

Thanks.

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 11/28/2013 1:12:51 AM
   
RE:Create a document type with upload a file
Hi,

Im glad to hear that.

There is not really a 100% way of showing "Save as" in all browsers. If you are using HTML 5 there is a new attribute which is exactly for this purpose and you can use it as:
<a href="path/to/file" download>Click here to download</a>

Also this is more of a server based solution, but it is generally not recommended for you to tamper with it as you can see from e.g. the following answer: http://stackoverflow.com/questions/6794255/html-download-a-pdf-file-instead-of-opening-them-in-browser-when-clicked

Also to your other question I can see that Filip is already working on that and he should answer you within several days, thank you for understanding. However from a brief review of your question it might be possible to use depending fields and with pulling the data out of the custom table with a custom query inside the same form control. So there might be chance of not developing the whole form control from scratch which would be advanced requests and we also are not able to provide you with the code for.

Can you more explore the possibilities with dependancy if it would suit your needs? You can try to refer to the following article -> http://devnet.kentico.com/Knowledge-Base/BizForms/Using-dependency-fields-in-forms.aspx

Let me know for further assistance.

Kind regards,
Richard Sustek

User avatar
Member
Member
dinethnipuna-gmail - 12/1/2013 5:09:31 PM
   
RE:Create a document type with upload a file
Hi Richard,
Thank you very much for your help.
I think the best way to go is use file upload option that is uploading the doc from desktop.
Then they can download without any issue.

But I hope in future Kentico will provide option to upload from media library and allow users to download without any issue.

Much appreciate your help.