Removing Uploaded Files in the Temporary File Location

Last post 11-20-2009, 3:17 AM by ArchSI. 5 replies.
Sort Posts: Previous Next
  •  11-18-2009, 3:57 AM 57236

    Removing Uploaded Files in the Temporary File Location

    Dear CuteSoft Support,
     
    We are new to your product... earlier we asked how we could upload our files to a desired folder during runtime. We found that this was possible by executing this statement during PageLoad():
     
     <CuteWebUI:UploadAttachments ID="FileBrowser" runat="server" InsertButtonID="Button1" ManualStartUpload="true" AutoUseSystemTempFolder="true" ShowRemoveButtons="True"></CuteWebUI:UploadAttachments>
    FileBrowser.TempDirectory = "C:\\Temp";  // this is the code-behind
     
    However, now that we can dynamically assign the Temporary File Location, once the files are uploaded into C:\\Temp, we cannot remove it with the Remove Button in the UploadAttachments control.  Are we doing something wrong here?
     
    As we are new and are evaluating this product, can you let us know how we can copy the uploaded files to another folder and restore the filename to its original name (e.g., convert your filename, say, persisted.a8bc9s8d-28d7s76-dis7s65a.file1.doc.resx back to its original name file1.doc)?
     
    Thanks in advance.
     
    Regards,
    Michael
     
  •  11-18-2009, 6:26 AM 57241 in reply to 57236

    Re: Removing Uploaded Files in the Temporary File Location

    hi ArchSI,
     
    You can do this in event FileUploaded, like below.
     
         <CuteWebUI:UploadAttachments ID="attachment1" runat="server" OnFileUploaded="attachment1_FileUploaded" TempDirectory="~/haha">
            </CuteWebUI:UploadAttachments>

        protected void attachment1_FileUploaded(object sender, UploaderEventArgs args)
        {
             //save upload file to another folder
             //you can change the upload file name here, like args.CopyTo("~/savefolder/"+"myname.jpg");
            args.CopyTo("~/savefolder/"+args.FileName);
             //delete the tem files in folder C:\\Temp
            args.Delete();
        }
     
    Regards,
     
    ken
  •  11-18-2009, 8:48 AM 57249 in reply to 57241

    Re: Removing Uploaded Files in the Temporary File Location

    Hi Ken,
     
    Thank you for your reply. If we were to define an event handler:
    protected void attachment1_FileUploaded(object sender, UploaderEventArgs args)
    {
    }
     
    wouldn't one have to add the a missing namespace (like, #using CuteWebUI.AjaxUploader;) as the compiler may return an error on the missing definition of UploaderEventArgs? We had been looking in the online documentation for a namespace to use but can't find one.
     
    Regards,
    Michael
  •  11-18-2009, 10:43 AM 57257 in reply to 57236

    Re: Removing Uploaded Files in the Temporary File Location

    Michael,
     
    You do not need take care the temp files.
     
    Temp file means the uploaded data & info of a file. it's owned by uploader , not your application.
     
    You do not need care what's the filename and why the name ends with '.resx'
     
    What you need to do is , in some event handler , move the file to some where you want .
     
    Try to use the properties/methods of the item/args .
     
    Please check the advanced sample for more.   the  Ajax-based-File-storage.aspx shall be fit for you.
     
    --
     
    by the way , you need set TempDirectory every time the page loads.
     
    here is the online document http://ajaxuploader.com/document/
     
    Regards,
    Terry
  •  11-19-2009, 3:40 AM 57279 in reply to 57257

    Re: Removing Uploaded Files in the Temporary File Location

    sorry, not here.
  •  11-20-2009, 3:17 AM 57315 in reply to 57257

    Re: Removing Uploaded Files in the Temporary File Location

    Thank you, Terry and Ken.  We figured it out with both your help.
View as RSS news feed in XML