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

Cannot write to the target folder!

13 Answers 289 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Amr Saafan
Top achievements
Rank 2
Amr Saafan asked on 23 Apr 2010, 10:45 PM
Hello,
I am getting the following error message when I try to save the edited image to another location in the Image Editor:
"Cannot write to the target folder!"

I am using 2008.02.1001.2 version.

I did a search about this issue but i found the solution is useless for me since I use an old version.
So Please show me how to fix this bug.

Thank you,
Amr Saafan
http://amrsaafan.blogspot.com/

13 Answers, 1 is accepted

Sort by
0
Rumen Jekov
Top achievements
Rank 1
answered on 24 Apr 2010, 09:17 PM
Hi,

It is recommended to upgrade to the latest version Q1 2010 SP1, in which this problem is fixed.

Additional reason for the upgrade is that version 2008.2.1001 does not offer support for IE8.

Best regards,
Rumen
0
Amr Saafan
Top achievements
Rank 2
answered on 31 May 2010, 10:47 AM
I have upgraded to 2010, 1, 519, 20 but I still facing the same problem.
How can I fix it?
0
Rumen
Telerik team
answered on 31 May 2010, 12:38 PM
Hi Amr,

Do you use your own custom FileBrowserContentProvider and trying to upload the image to another directory?

A possible reason for the message can be that the application does not have the needed permissions to create files/folders inside the directories  that is set to the UploadPaths (the resourcesFilePath variable) of the  RadFileExplorer control.

In your case I recommend you to perform this test:
  • Remove the RadEditor (or all RadControls) from the page
  • In the code behind of the same page where the RadEditor was declared add this code :
    Copy Code
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            System.IO.Directory.GetDirectories("Path");
            System.IO.Directory.GetFiles("Path");
            System.IO.Directory.CreateDirectory("Path");
            System.IO.Directory.Delete("Path");
            System.IO.File.Delete("Path");
     
        }
        catch (Exception ex)
        {
            string message = ex.Message;
        }
    }
  • The "Paths" string should be replaced with the paths that are set to the UploadPaths properties of the RadEditor . You can use Server.MapPath in order to retrieve the ( for example: Server.MapPath("~/ExampleVirtualPath")) in order to get the physical paths, because these methods accept physical path, not virtual.
  • You need to add a break point to the beginning of the Page_Load event and make sure that the code is executed without any exceptions.
  • If an exception is thrown, then you will be sure that the problem is in the Server's permissions set to the folder(s) and not in the RadControls.
  • You can get more information about the error by examining the highlighted ex.Message property.

Could you please perform this test and let me know the result? In case, however, that an exception is thrown, then I recommend you to contact the administrator of the server and ask him to provide the needed permissions.

Greetings,
Rumen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Amr Saafan
Top achievements
Rank 2
answered on 04 Jun 2010, 10:22 PM
I don't use custom FileBrowserContentProvider, I have test your code and there are no exceptions at all I have all the needed permissions on every directory in the Web Site.

All what I want to do is change the path of the new generated thumb photo of the image editor to another path, by default it is photoname_thumb.jpg I need to save it to another directory like /Images/photoname_thumb.jpg or /myphotos/profileimages/photoname_thumb.jpg
 
Thank you,
Amr Saafan
Senior Software Developer
http://amrsaafan.blogspot.com/
0
Rumen
Telerik team
answered on 09 Jun 2010, 02:56 PM
Hi Amr,

Due to security reasons the Image Editor does not offer the requested functionality to save the edited thumbnail to another directory different from the location where the original image resides. All thumbnails are saved in the folder in which the original images exist. If the user was able to store images in locations not specified in the UploadPaths property then the server will be flooded by images in all directories.

Nevertheless, if you would like to enable this feature on your own risk, then you can implement a custom FileSystemContentProvider and override the StoreBitmap method (used to save a newly created bitmap to the storage). You can see how to implement a FileSystemContentProvider in this KB article: Retrieving the size of the uploaded file(s) and restricting file upload. More information about the methods of the provider are available in this demo: Custom File Dialogs Content Provider.

Best regards,
Rumen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Amr Saafan
Top achievements
Rank 2
answered on 13 Jun 2010, 04:59 PM
Well, I did the custom FileSystemContentProvider and override the StoreBitmap method but when I try to save the new image to another path it gives me the same error Cannot write to the target folder! and don't go into the StoreBitmap method.
but if I leave the path as it is it goes into the StoreBitmap method.

Please provide a solution to this bug.

Thank you,
Amr Saafan
Senior Software Developer
http://amrsaafan.blogspot.com
0
Rumen
Telerik team
answered on 15 Jun 2010, 01:22 PM
Hi Amr,

I talked with one of our RadEditor developers and he explained that the reported behavior is expected and by design.

The image editor calls the CheckWritePermissions method of the FileBrowserContentProvider in order to check the applied permissions to a specific path. Since the newly entered path is not part of the allowed paths for image upload / write the StoreBitmap method is not called.

Our recommendation is to not change the path of the newly generated thumb photo of the image editor to another path, but store the file to the desired new location(s) in the StoreBitmap method of the FileSystemContentProvider.


Best regards,
Rumen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
-DJ-
Top achievements
Rank 1
answered on 26 Aug 2010, 03:02 PM
Hi,
I get this error when running a standalone image editor dialog in Q2 2010.

I've tried running my own version of ImageEditor.ascx to figure out the problem but haven't succeeded.

For some reason editing that file doesn't always work, like some of the functions are being called from elsewhere.
For example:
//if (!name || name.indexOf(separator) != -1) {
//  alert(localization["MessageCannotWriteToFolder"]);
//  return;
//}

with this commented out I still get the alert.

But it doesn't really matter, what matters is that I can't save images from the editor.

Regards,
-DJ-
0
Rumen
Telerik team
answered on 30 Aug 2010, 09:47 AM
Hello -DJ-,

The problem could be due to that you are using an older version of ImageEditor.ascx file. You should test using the the ImageEditor.ascx file provided in the EditorDialogs folder in the Q2 2010 installation.

Best regards,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
-DJ-
Top achievements
Rank 1
answered on 31 Aug 2010, 03:53 PM
Hi Rumen.

I am using the most recent version of ImageEditor.ascx.
The problem still exists even when I'm not using a custom version of it.

I might still be using some old resx files for localization, that can't be the reason can it?

Any other thoughts?

Regards,
-DJ-
0
Rumen
Telerik team
answered on 02 Sep 2010, 09:35 AM
Hi -DJ-,

Can you please just for test set the UploadPaths propertry values to be a forward slash, e.g.

<ImageManager UploadPaths="/" ...

If you do not use a ContentProvider or a customized external ImageEditor.ascx dialog, you can isolate the problem in a sample working application and send it for examination by opening a support ticket.

If you have customized the ImageEditor.ascx dialog, remove the changes and test again.

Best regards,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
shadow
Top achievements
Rank 2
answered on 11 Dec 2012, 01:14 PM
Hello,

I am having several issues with ImageEditor.
Here is how I have configured it,
  • External Dialogs
  • CustomContentProvider
  • Uploading Images in directory instead of saving them in database.

Issues:
  • Can not save to target directory
  • Images are not refreshed in image manager after image is saved.

Scenario:
After editing some image when I click the save button, it gives the alert ("Can not save to target directory.") and after clicking the save button fourth time the message doesn't appear and image is saved, but now the Image is not refreshed in ImageManager. If I clear the browser cache then the edited image is displayed in image manager!!

Note:
My target folder is configured as a separate virtual directory.

I am fighting with these issue now from last one month, explored several forum posts and tried what I have figured out... Can you please help me to fix these issues???

Thank you all.  
0
Vessy
Telerik team
answered on 14 Dec 2012, 12:40 PM
Hi Farid,

I have just answered your other post on the subject and you can find it here: http://www.telerik.com/community/forums/aspnet-ajax/editor/can-not-write-to-target-folder-with-image-editor.aspx.

Kind regards,
Vesi
the Telerik team
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 their blog feed now.
Tags
Editor
Asked by
Amr Saafan
Top achievements
Rank 2
Answers by
Rumen Jekov
Top achievements
Rank 1
Amr Saafan
Top achievements
Rank 2
Rumen
Telerik team
-DJ-
Top achievements
Rank 1
shadow
Top achievements
Rank 2
Vessy
Telerik team
Share this question
or