Can i change the temporary uploaded filename?

Last post 10-07-2011, 8:45 AM by ScottDolan. 2 replies.
Sort Posts: Previous Next
  •  10-06-2011, 2:23 PM 70301

    Can i change the temporary uploaded filename?

         After uploading a file to using ajaxuploader.  The file uploaded to the tempDirectory are renamed to something similar to this "persisted.aa5b8ba2-4d86-4681-92a2-bff277698419.new.png.resx" 
        However, I would like to make use of this temporary image I just uploaded for a little bit while I am cropping the image.   Is there a way to control how the file is named in the temp directory..  Basically, i just need to remove the .resx from the file name but, i still want ajaxuploader to  delete after 5hrs goes by.  
  •  10-07-2011, 7:31 AM 70314 in reply to 70301

    Re: Can i change the temporary uploaded filename?

    Hi ScottDolan,
     
    Please use method "CopyTo" to save the upload file.
     
    <%@ Page Language="C#" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <script runat="server">

     
        protected void uploader1_FileUploaded(object sender, UploaderEventArgs args)
        {
            args.CopyTo("~/photos/"+args.FileName);
        }
    </script>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>example</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <CuteWebUI:UploadAttachments ID="uploader1" runat="server" OnFileUploaded="uploader1_FileUploaded">
                </CuteWebUI:UploadAttachments>
            </div>
        </form>
    </body>
    </html>
     
     
    Regards,
     
    Ken
  •  10-07-2011, 8:45 AM 70316 in reply to 70314

    Re: Can i change the temporary uploaded filename?

    Ken,
            I was hoping for a solution that would let me override the filename created by ajaxuploader ie. the resx  file.  Ideally, i wanna use the .resx file created by ajaxuploader because it automatically deletes. My problem is the resx at the end of the file makes it problem to use the file.   
     
           The args.CopyTo("~/photos/"+args.FileName); method will work to copy the file but then i will have to delete the file manually after x amount of hours.
     
     
View as RSS news feed in XML