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

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...How to delete a file after upload (URL control)How to delete a file after upload (URL control)
Previous
 
Next
New Post
9/24/2008 9:52 AM
 

Hi,

I have a module that allows a user to upload a file and processes it (XML). My users are complaining that everyone can see everyone else's files on the server and it contains sensitive info. A simple solution is to therefor delete the .xml file immediately after upload/processing, but I can't see a simple way to do this unless I am missing something obvious:

Here is what I have so far - this causes the file to be erased everytime, but I only want to erase it IF the user uploaded it. There doesn't seem to be an Upload event on the URL control or I could set a flag - I tried the IsPostBack but that does not work. I do not want users selecting other files already on the server and deleting them - I have to somehow workout if they have just uploaded it. It's a pity the FileInfo object does not store the UserID property or it would make life so simple:

                    string filename = txtFileName.Url;
                    if (filename.Length != 0 && filename.StartsWith("FileID="))
                    {
                        FileController fileController = new FileController();
                        FileInfo fileInfo = new FileInfo();
                        int fileID = Convert.ToInt32(filename.Replace("FileID=", ""));
                        fileInfo = fileController.GetFileById(fileID, this.PortalId);
                        validXML = xmlImport.ReadAndValidateXML(fileInfo.PhysicalPath);
                       
                        if (txtFileName.IsPostBack)
                        {
                            fileController.DeleteFile(this.PortalId, fileInfo.FileName, fileInfo.FolderId, true);
                        }


Entrepreneur

PokerDIY Tournament Manager - PokerDIY Tournament Manager<
PokerDIY Game Finder - Mobile Apps powered by DNN
PokerDIY - Connecting Poker Players

 
New Post
9/24/2008 11:41 AM
 

Rodney,

  • why do you provide the URLControl instead of webUpload?
  • to delete a file, please call DotNetnukeCommon.Utilities.FileSystemUtils.DeleteFile

 


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
9/24/2008 6:56 PM
 

Hi Sebastian,

 

  • Ignorance ;) I thought that using the core control would be the best way of doing it - it's worked up until now but I don't like the UI.
  • Will do.

 

Is the control you sent the WebUpload control? I'll try it now - thanks.


Entrepreneur

PokerDIY Tournament Manager - PokerDIY Tournament Manager<
PokerDIY Game Finder - Mobile Apps powered by DNN
PokerDIY - Connecting Poker Players

 
New Post
9/30/2008 3:16 AM
 

Hi Sebastian,

Thanks for sending me the SimpleUpload control. I have it working now but I have a few questions:

  1. Is there anyway of telling which file was last uploaded? I kinda expected a property on the control with the filepath of the last file so that on Update (or whatever) I could then load this file. I currently have hooked into the OnTempSave event and am using the tempfilepath but I thought there may be an easier way.
  2. I could not find the SimpleUpload.resx file in the project - is this intentional?
  3. The control does not seem to function correctly when EnablePartialRendering is used - is this a known issue?

It would be great if this control made it into the code forge ;)

 


Entrepreneur

PokerDIY Tournament Manager - PokerDIY Tournament Manager<
PokerDIY Game Finder - Mobile Apps powered by DNN
PokerDIY - Connecting Poker Players

 
New Post
9/30/2008 3:33 AM
 

Hi Rodney,

I will need to have a look into the source code myself the next days to answer your questions.


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...How to delete a file after upload (URL control)How to delete a file after upload (URL control)


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