trailing slash in file paths causing upload problems

Last post 04-09-2010, 11:37 PM by capnhairdo. 2 replies.
Sort Posts: Previous Next
  •  04-01-2010, 9:43 PM 59820

    trailing slash in file paths causing upload problems

    Though it's not pointed out in the documentation, seems CuteEditor seems to want paths specified for Images, Media, Flash & Documents to NOT have a trailing slash.
     
    <security  name="FilesGalleryPath">~/uploads</security>
     
    editor.FilesGalleryPath = "/Uploads"
     
    But what if I want to specify the root directory for any of these? What do I put in? Seems like an empty string should indicate the root folder:
     
    editor.FilesGalleryPath = ""
     
    But doing this causes either permission warnings, HTTP 500: Permission denied errors or VBScript "Path Not Found" errors for me—depending on the server and configuration.
     
    So of course I tried a forward slash instead. That seems to work okay. Until you I tried uploading a file. The uploader chokes on this, and I got
     
    Server side exception, failed to upload
    Unable to write file to temp directory
     
    from the Flash uploader and

    Permission denied
    /cuteeditor_files/Dialogs/aspuploader/include_aspuploader.asp, line 489

    from the iFrame version.

    When I did manage to get it to work on one server, I started getting double forward slashes prepended to my uploaded file links. This is a problem because CuteEditor—when using absolute URLs—will convert any link beginning with // to http://. So I end with links like
     
    http://myfile.pdf
     
    In exasperation, I also tried variations like:
     
    editor.FilesGalleryPath = "/."
    editor.FilesGalleryPath = "../"
     
    The first one actually seems to work. My links get inserted like this:
     
    /./card_code.html
     
    But with absolute URLs on, they get cleaned them up. Still, this seems like a hack at best, which I wouldn't recommend.
     
    So how the heck do you correctly specify the root folder for any of these? And why aren't forward slashes automatically removed if they're not appropriate, rather than causing everything to blow up?
     
    Going back to using just a forward slash, I managed to fix the "http://" problem above by changing this line in cuteeditor_files\Dialogs\upload_handler.asp:
     
    Response.Write "<script language=javascript>parent.UploadSaved('" & FilePath &"/" & File.FileName & "','"&FilePath&"');</script>"
     
    to this:
     
    If Right(FilePath,1) <> "/" Then
      outputPath = FilePath & "/" & File.FileName
    Else
      outputPath = FilePath & File.FileName
    End If
    Response.Write "<script language=javascript>parent.UploadSaved('" & outputPath & "','"&FilePath&"');</script>"

    Seems like something like this should have been there already.
  •  04-05-2010, 10:32 AM 59872 in reply to 59820

    Re: trailing slash in file paths causing upload problems

    >>But what if I want to specify the root directory for any of these? What do I put in? Seems like an empty string should indicate the root folder:
    It should be
     
    <security name="FilesGalleryPath">/</security>

     


    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  04-09-2010, 11:37 PM 59981 in reply to 59872

    Re: trailing slash in file paths causing upload problems

    Thanks. As I said, that's what I ended up using. But the problem remains that CuteEditor seems to want and expect no trailing slash, and all the problems I mentioned (with uploading and double slashes) still seem to occur. Suggest you revise your code so it works regardless of trailing slashes. Some of your code already does, but it's not consistent.
View as RSS news feed in XML