This is a migrated thread and some comments may be shown as answers.

TargetFolder problem

6 Answers 159 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Troy
Top achievements
Rank 1
Troy asked on 15 Jan 2014, 02:43 PM
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">

 

6 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 16 Jan 2014, 06:34 AM
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.
0
Troy
Top achievements
Rank 1
answered on 16 Jan 2014, 06:51 AM
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?
0
Kate
Telerik team
answered on 20 Jan 2014, 02:51 PM
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.
0
Troy
Top achievements
Rank 1
answered on 21 Jan 2014, 07:11 AM
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?
0
Accepted
Kate
Telerik team
answered on 23 Jan 2014, 12:06 PM
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.
0
Troy
Top achievements
Rank 1
answered on 24 Jan 2014, 02:21 AM
Awesome. Thanks for the tips!
Tags
AsyncUpload
Asked by
Troy
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Troy
Top achievements
Rank 1
Kate
Telerik team
Share this question
or