dongmijgnnq0118
2017-11-07 15:49
浏览 60
已采纳

Azure .mp4上传失败

Good Morning,

We have setup a Laravel project on an Azure App Service. Were working on the ability to upload .mp4 files. If we try to upload .zip, .jpg, .doc etc they all work without fail. The .mp4 files though always give a error. Most of the answers we've found say its the web.config but we think its correct. Heres some info:

Error we get: 404 Not Found: The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

My web.config file location is: D:\home\site\wwwroot\public\web.config

My upload directory is: D:\home\site\wwwroot\public\test

My web.config looks like:

<configuration>
  <system.webServer>
    <staticContent>
      <mimeMap fileExtension=".mp4" mimeType="application/octet-stream" />
      <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
    </staticContent>
    <handlers accessPolicy="Read, Script">
      <add name="PHP71_via_FastCGI" path="*.php" verb="GET, HEAD, POST, PUT, DELETE, PATCH, OPTIONS" modules="FastCgiModule" scriptProcessor="D:\Program Files (x86)\PHP\v7.1\php-cgi.exe"
        resourceType="Either" requireAccess="Script" />
      <remove name="ExtensionlessUrl-Integrated-4.0" />
      <add name="ExtensionlessUrl-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,DELETE,PUT,PATCH,OPTION" type="System.Web.Handlers.TransferRequestHandler"
        preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
    <rewrite>
      <rules>
        <rule name="Imported Rule 1" stopProcessing="true">
          <match url="^(.*)/$" ignoreCase="false" />
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
          </conditions>
          <action type="Redirect" redirectType="Permanent" url="/{R:1}" />
        </rule>
        <rule name="Imported Rule 2" stopProcessing="true">
          <match url="^" ignoreCase="false" />
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
          </conditions>
          <action type="Rewrite" url="index.php" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

As you can see we have the mimeMap in there. We've tried both application/octet-stream and video/mp4. Anyone have any thoughts/ideas? We tried placing the web.config in other folders as well with the same issue.

One other thing I tried was going into Kodu and manually uploading the file through there. It worked but if you try to access the .mp4 it shows the same error as when I'm trying to upload through the site.

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • dongtai419309 2017-11-08 02:46
    最佳回答

    Is the .mp4 file size bigger than 8MB? if so, you need to increase file upload size limits.

    Create a file called .user.ini with the following content and place it into your root directory.

    ; Maximum allowed size for uploaded files.
    upload_max_filesize = 2048M
    
    ; Must be greater than or equal to upload_max_filesize
    post_max_size = 2048M
    

    If file size bigger than 30MB, you also need to add this to the web.config file.

    <system.webServer>
      <security>
        <requestFiltering>
          <requestLimits maxAllowedContentLength="2147483648" />
          <!--Byte in size, increase it to 2GB-->
        </requestFiltering>
      </security>
    </system.webServer>
    
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题