Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...file upload processfile upload process
Previous
 
Next
New Post
5/12/2008 9:58 AM
 

In the settings of a new module I am creating, I would like the user to be able to upload an image file of their choice to act as a form of icon,

I would like this to work in the same way that an admin user can upload an image to use as a site header in the admin>settings page.

What I don;t want to have to do is re-invent the wheel. The code used in the settings page would do the job for me, but even though I have downloaded the entire source code, I can't find this page so that I can review the code.

Is there a simple DNN function already available that I can use to upload files?

Is there an example available on how to do this?


Blue & White hooped blood runs through my veins!
 
New Post
5/12/2008 2:53 PM
 

You can use the DNN UrlControl to handle the file upload, this is the control that you see on the Site Settings page for the logo.


-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
New Post
5/21/2008 12:12 PM
 

Thanks Mitch, I got the upload working.

 

However I now have another problem and that is getting the virtual path of the file that has been uploaded so that I can display it in my module.

I store the file id (38) and I use the

DotNetNuke.Services.FileSystem.FileController.GetFileById(HRGi.ImageID, PortalId)

to populate a DotNetNuke.Services.FileSystem.FileInfo object

BUT this fileinfo object only gives the Physical path:

?objFileInfo

{DotNetNuke.Services.FileSystem.FileInfo}

ContentType: "image/gif"

Extension: "gif"

FileId: 38

FileName: "newspaper.gif"

Folder: ""

FolderId: 16

Height: 114

IsCached: False

PhysicalPath: "C:\DotNetNuke Sites\DNN_481\Portals\0\newspaper.gif"

PortalId: 0

Size: 12428

StorageLocation: 0

Width: 114

 

Any idea's how I get the virtual path from the FileID, so that I can display the uploaded image within my module?


Blue & White hooped blood runs through my veins!
 
New Post
5/22/2008 11:27 AM
 

You should be able to pass the path value to the ResolveClientUrl method to get the link.  Now you have to be careful though that the file isn't in a secured folder.


-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...file upload processfile upload process


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out