Inserting a video into a page

Topics: Business Logic Layer, Controls
Mar 23, 2014 at 12:31 AM
I'm trying to edit a page on my website and I'm receiving Import failed when I click the button to insert video. Is this a security issue?
Apr 2, 2014 at 3:40 PM
HollywoodBound wrote:
I'm trying to edit a page on my website and I'm receiving Import failed when I click the button to insert video. Is this a security issue?
I'm having the same problem and found this post searching for the answer. I increased the file size for downloads in the setting but it didnt help.
Apr 14, 2014 at 3:05 PM
Edited Apr 14, 2014 at 3:06 PM
Had the same issue just now, I found the cause (well, a cause anyway), tested in IE10 and IE11:

Tools > Internet Options > Security > Custom level...
you will find a setting:
Miscellaneous > "Include local directory path when uploading files to a server"

If it is disabled, the server will receive a file name like "test.pdf". When it is enabled, it will receive "C:\users\someone\desktop\test.pdf". I'm assuming BlogEngine doesn't strip off the full path and tries to save "D:\inetpub\Blog\App_data\files\C:\users\someone\desktop\test.pdf" or something, which doesn't work.

If your site is in the Trusted zone or Local intranet zone, the setting will be enabled. So, either move your site out of the trusted or intranet zone, or disable that setting and all will be fine...
Apr 14, 2014 at 3:30 PM
Alternatively, go to App_Code\Api\UploadController.cs and add this snippet (just the last 6 lines, the first lines are for location and should not be changed):
public HttpResponseMessage Post(string action)

    HttpPostedFile file = HttpContext.Current.Request.Files[0];
    action = action.ToLower();

    // strip the local path off the file name
    string fileNameStripped = file.FileName;
    if (fileNameStripped.Contains("\\"))
        fileNameStripped = fileNameStripped.Substring(fileNameStripped.LastIndexOf("\\") + 1);
Then, in this document only, below the added lines, replace all instances of "file.FileName" with "fileNameStripped" and the problem will be gone!

Until the next update maybe... This is for 2.9.1 by the way.
Apr 21, 2014 at 2:52 PM
nothing has fixed this problem. the code in my Version V2.9.1 is different than the above code.
Apr 22, 2014 at 10:05 AM
Okay, I checked again and there are 2 problems here:
  1. "Import failed" on all uploads (image, file, video) may be caused by the client sending the full local file path. This happens when the client views your site in the trusted or intranet zone. See my previous comments for that. Also
  2. "Import failed" just for video uploads: videos are saved by default in the folder /media, not in /App_Data. You will have to set Write permissions on /media. Note that the folder can also be changed in the settings for the extension "MediaElementPlayer".
@jayirvin: I hope your problem is fixed by nr 2. Strange that your code is different, did you try a global search for "public HttpResponseMessage Post(string action)"?