TargetFolder problem

7 posts, 1 answers
  1. Troy
    Troy avatar
    11 posts
    Member since:
    Aug 2012

    Posted 15 Jan 2014 Link to this post

    Hi, I set up the vb.net demo as per below
    http://demos.telerik.com/aspnet-ajax/imageeditor/examples/imageupload/defaultvb.aspx?product=asyncupload#qsf-demo-source

    When I add a "TargetFolder" the temp file creates itself in RadUploadTemp,  but immediately disappears.

    It only works if I remove the target folder. i.e the temporary file remains in RadUploadTemp and I can manipulate the image.

    Why is it failing if I set a TargetFolder?

    <telerik:RadAsyncUpload ID="AsyncUpload1" runat="server" OnClientFilesUploaded="OnClientFilesUploaded"

    OnFileUploaded="AsyncUpload1_FileUploaded" MaxFileSize="2097152" AllowedFileExtensions="jpg,png,gif,bmp"

    AutoAddFileInputs="false" Localization-Select="Select" TargetFolder="~/images">

     

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 16 Jan 2014 Link to this post

    Hi Troy,

    In RadAsyncUpload the Uploaded files are stored in a temporary location until a postback occurs. The temporary location is cleaned-up automatically.  When posted, files are saved to the designated temp folder (App_Data/RadUploadTemp by default) with unique names. Once a postback occurs the RadAsyncUpload fires the OnFileUploaded event for each file. After the events fire, all files are automatically saved to the TargetFolder. Finally, all processed temporary files are deleted. If there is no TargetFolder is set , the uploaded file remains in the TemporaryFolder and it will automatically delete after 4 hours.

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Troy
    Troy avatar
    11 posts
    Member since:
    Aug 2012

    Posted 16 Jan 2014 Link to this post

    Ok, so understanding the behaviour of this example
    http://demos.telerik.com/aspnet-ajax/imageeditor/examples/imageupload/defaultvb.aspx?product=asyncupload#qsf-demo-source

    If I set the Target Directory property, and select a file, it is copying it immediately to the Target Directory and therefore immediately deletes the temporary file, so I don't have the opportunity to manipulate the temporary file in the editor before saving it.

    Have I understood that correctly?

     I had assumed the example wouldn't copied the file to the target folder until I pressed "save" on the image editor.

    So how do I prevent the file being immediately copied to the Target Folder in the context of this example?
  5. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 20 Jan 2014 Link to this post

    Hi Troy,

    To be able to manipulate the files as desired you can use the OnFileUploaded event and implement the desired logic in the event handler. Note, however, that you should not set the TargetFolder property in the markup of the control. Attached to this post you can find a very simplified project. Give it a try and let me know how it goes.

    Regards,
    Kate
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  6. Troy
    Troy avatar
    11 posts
    Member since:
    Aug 2012

    Posted 21 Jan 2014 Link to this post

    Great thanks, your info and sample has put me on the right track.

    I can now upload, manipulate and save the image, and manipulate an existing image and save it.

    Another question. When clicking "save" on the image editor, is it possible to stop the dialogue box appearing and force It to just save to the server and use the existing filename, and pop-up a save-file success or failure message?
  7. Answer
    Kate
    Admin
    Kate avatar
    1898 posts

    Posted 23 Jan 2014 Link to this post

    Hello Troy,

    You can prevent the dialog box to appear and respectively add the needed logic when clicking on the save button. Here you can check how this could be achieved using the RadEditor control.

    Regards,
    Kate
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  8. Troy
    Troy avatar
    11 posts
    Member since:
    Aug 2012

    Posted 23 Jan 2014 Link to this post

    Awesome. Thanks for the tips!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017