I really hate asking questions like this... but could someone point me to some examples of how to upload a file in a custom DNN 9 SPA module? I have been looking and have not been able to find anything.
Thank you in advance
You can use the build-in DnnFilePicker
<%# Register TagPrefix="dnn" Assembly="DotNetNuke.Web" Namespace="DotNetNuke.Web.UI.WebControls" %>
<dnn:DnnFilePicker runat="server" ShowFolders="false" ID="fpUserFiles" FileFilter="pdf,gif,jpg" />
You can really use any client-side file upload (e.g., DropZone, jQuery Upload, standard HTML 5 upload, etc.) and then use a DNN Web API endpoint to perform the server-side saving of the file.
Related
I am trying to create buttons on a web page that allow users to share links to PDF documents on LinkedIn. LinkedIn loads a window without any errors but offers no link or preview of the PDF or any indication of what is being shared.
Here are the two methods I have tried. First the plugin method.
<script type="in/share" data-url="http://example.net/DocumentDownload.aspx?Command=Core_Download&entryID=114"></script>
And, secondly with a custom url.
TEST
Encoding the url makes no difference.
The above links are direct document links from a DNN web site using Document Exchange. If I change the urls to any html page it works fine and LinkedIn seems to be able to extract the useful information right from the page and use that for the share details.
Can LinkedIn handle this kind of thing? There is nothing to guide me on the type of links that can be shared. I can't find any information about it. There are no errors in the web console.
Not sure, but you should try to provide LinkedIn with the link that has .pdf at the end, like http://example.com/documents/file1.pdf. I guess LinkedIn just checks the URL if it has .pdf file at the end to decide if it is a PDF document or not.
I have no problem sharing pdf's on LinkedIn. Check it out...
https://www.linkedin.com/sharing/share-offsite/?url=https://www.revoltlib.com/anarchism/the-conquest-of-bread/view.pdf
Works perfectly fine. And view.pdf is a script, not a file, either, so, it's not looking for a PDF file to analyze, so much as headers that indicate you have a PDF file available to analyze, so, in PHP, at DocumentDownload.aspx, we would do...
header('Content-type: application/pdf; charset=utf-8');
This header let's the sharing app know that it can analyze the document as a PDF file and extract useful information from it, as you can see from the screen shot.
Im looking for some guidance on a responsive site design written using Bootstrap 3.
Basically I want the mobile version to be as lightweight as possible and only load JS and HTML that is necessary for the mobile view, and not load assets required for the desktop view. I would like to ignore loading specific JS files when the page is loaded via a mobile device.
Is there a simple method to do this with Bootstrap?
My guess is that I need a Javscript function to detect the device and use that as a trigger, however I was wondering if Bootstrap had this capability that I could use?
Appreciate any thoughts.
It seems there is already answer to detect mobile browser with javascript. Detecting a mobile browser
Otherwise you can detect the mobile device by using http_user_agent to decide not to load assets when the page is loading.
Here is already answer to detect mobile device with php.
Check if PHP-page is accessed from an iOS device
You can perhaps do it by user agent. There is an answer here that might help
Load a javascript file and css file depending on user agent
I write a standalone aspx file and upload it to DNN website. I add a html module and make an iframe to that aspx file. How I should check DNN user login or not in aspx file? I think there are something in Session but it is empty when I print it out on aspx page.
The aspx file executes outside of DNN. There is no context for you to work with. A much better approach is to turn your .aspx into a .ascx and derive from PortalModuleBase as the start of a DNN module. You can add a proper module to the page and permission the module as you see fit and DNN will take care of all the authentication and authorization details for you.
A starting point for module development
I don't recommend it in this situation, but you can also emulate the approach I described for getting context in a web service.
https://stackoverflow.com/a/9164573/51851
If your aspx is within DNN's website you can simply use Request.IsAuthenticated to check if user is logged in or not.
But be warned, if you have friendly URL turned on - DNN 5x and above will hijack you aspx request.
how do i upload an image to the portal and use it in my html of my html module?
i have an html module i want to use and part of it is an image. how do i upload to my portal and then reference the url where it is on my server inside my html?
In case you didn't see my comments on the other one. One way is to just find the file on the hard drive and figure out the link manually in relation to your web root. But if you are using this as a portal system then this might not be the best solution.
There is also upload option right withing html editor. click on image manager icon and it will give you the option to upload an image.
alt text http://images.devs-on.net/Image/rw5tTdgNRgs22f1-MyWebsiteHomeAlp.png
alt text http://images.devs-on.net/Image/YjlGTN1GTUVMR1p-MyWebsiteHomeAlp.png
If your HTML is being put in the DNN HTML module, you could also use the media picker baked in.
If you want a more integrated option, you could use the DNN FileManager API to accomplish integrated uploading and retrieving of files. The DNNFilePickerUploader might come in handy for this, which will give you a DNN file ID which you could the use to get the image url.
I am developing a basic mobile site in asp.NET and C# and am having problems rendering .aspx pages on certain mobile phone browsers.
I tried Stackoverflow.Mobi on a nokia looking for good examples for coding mobile sites.
As soon as I redirect to another page I receive the error "File Format Unknown."
As soon as i use the button_click event to transfer to another page the "File Format Unknown." shows up on the mobile divice.
I have tried the following as suggested fixes from numerous forums but without any luck.
Setting Page contentype : ContentType="text/html"
Server.Transfer
Response.ContentType = "application/xhtml+xml";
Response.Redirect("Test.aspx");
Posting to the Full URL www.XXXX.com/test.aspx
One of the phones i am having problems with is a Nokia 6300
Any suggestions?
Normaly this is a problem with doc-type, because asp.net changes it to wap/application. I will recommend you use Fiddler for checking http headers. Normaly,Page directive ContentType should solve it
<%# Page Language="C#" ... ContentType="text/html" %>
But you have set :-S
Make sure your html passes w3c validation. I know Blackberry device will have trouble displaying pages where the Html does not validate according to the doctype.