﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Upload does not work!</title><link>http://www.aspplayground.net/forum/</link><description /><copyright>(c) ASP Playground Support Forum</copyright><ttl>30</ttl><item><title>Upload does not work! (Samuel)</title><description>  &lt;b&gt;NOTE: Part of this Q &amp;amp; A applies to the 2.x version (whenever you see reference to ASP in a Q). However, the answers applies to all versions.&lt;/b&gt;        &lt;br&gt;   &lt;br&gt;  &lt;font size="4"&gt;&lt;a name="qtop"&gt;&lt;/a&gt;&lt;/font&gt; &lt;br&gt;  &lt;ol&gt;&lt;li&gt;&lt;font size="3"&gt;I have enabled upload in the admin control panel and set the file size    / file extension according to your online help file. I still can' t get    the upload feature working!&lt;/font&gt;&lt;font size="3"&gt; &lt;a href="#q1"&gt;see solution --&amp;gt;&lt;/font&gt;&lt;font size="3"&gt;&lt;/a&gt;&lt;/font&gt;&lt;li&gt;&lt;font size="3"&gt;I get the same &lt;b&gt;permission denied&lt;/b&gt; error when I tried to upload stock avatars via the admin control panel. &lt;/font&gt;&lt;font size="3"&gt;&lt;a href="#q2"&gt;&lt;/font&gt;&lt;font size="3"&gt;see solution&lt;/font&gt;&lt;font size="3"&gt; --&lt;/font&gt;&lt;font size="3"&gt;&amp;gt;&lt;/font&gt;&lt;font size="3"&gt;&lt;/a&gt;&lt;/font&gt;&lt;li&gt;&lt;font size="3"&gt;[&lt;b&gt;2.x version&lt;/b&gt;] My server is &lt;b&gt;IIS 6&lt;/b&gt;, and I cannot upload more than 200KB at a time. &lt;/font&gt;&lt;font size="3"&gt;&lt;a href="#q3"&gt;&lt;/font&gt;&lt;font size="3"&gt;see solution&lt;/font&gt;&lt;font size="3"&gt; --&lt;/font&gt;&lt;font size="3"&gt;&amp;gt;&lt;/font&gt;&lt;font size="3"&gt;&lt;/a&gt;&lt;/font&gt;&lt;li&gt;&lt;font size="3"&gt;My ASP.NET version doesn't seem to allow uploading more than 4 MB of files. &lt;/font&gt;&lt;font size="3"&gt;&lt;a href="#q4"&gt;&lt;/font&gt;&lt;font size="3"&gt;see solution&lt;/font&gt;&lt;font size="3"&gt; --&lt;/font&gt;&lt;font size="3"&gt;&amp;gt;&lt;/font&gt;&lt;font size="3"&gt;&lt;/a&gt;   &lt;/font&gt;&lt;li&gt;&lt;font size="3"&gt;When a user tried to attach a file to a message or upload an image, this error occurre:&lt;/font&gt;&lt;font size="3"&gt;        &lt;br&gt;      &lt;i&gt;System.IO.DirectoryNotFoundException: Could not find a part of the path "D:\". &lt;/i&gt;&lt;/font&gt;&lt;font size="3"&gt;&lt;a href="#q5"&gt;&lt;/font&gt;&lt;font size="3"&gt;see solution&lt;/font&gt;&lt;font size="3"&gt; --&lt;/font&gt;&lt;font size="3"&gt;&amp;gt;&lt;/font&gt;&lt;font size="3"&gt;&lt;/a&gt;&lt;/font&gt;     &lt;li&gt;&lt;font size="3"&gt;What settings do I have to set to prevent people from executing    malicious code on my server if I decide to enable upload for the forum?&amp;nbsp; &lt;/font&gt;&lt;font size="3"&gt;&lt;a href="#q6"&gt;&lt;/font&gt;&lt;font size="3"&gt;see solution&lt;/font&gt;&lt;font size="3"&gt; --&lt;/font&gt;&lt;font size="3"&gt;&amp;gt;&lt;/font&gt;&lt;font size="3"&gt;&lt;/a&gt;&lt;/font&gt;&lt;li&gt;&lt;font size="3"&gt;&lt;b&gt;New users &lt;/b&gt;are not able to upload/embed images with their posts. All older user can, but just new users cannot.&lt;/font&gt;&lt;font size="3"&gt; &lt;a href="#q7"&gt;&lt;/font&gt;&lt;font size="3"&gt;see solution&lt;/font&gt;&lt;font size="3"&gt; --&lt;/font&gt;&lt;font size="3"&gt;&amp;gt;&lt;/font&gt;&lt;font size="3"&gt;&lt;/a&gt;&lt;/font&gt;&lt;li&gt;&lt;font size="3"&gt;[&lt;b&gt;2.x version&lt;/b&gt;] Users uploaded avatars via their profile pages but the avatars didn't seem to be saved correctly.&lt;/font&gt;&lt;font size="3"&gt; &lt;a href="#q8"&gt;&lt;/font&gt;&lt;font size="3"&gt;see solution&lt;/font&gt;&lt;font size="3"&gt; --&lt;/font&gt;&lt;font size="3"&gt;&amp;gt;&lt;/font&gt;&lt;font size="3"&gt;&lt;/a&gt;&lt;/font&gt;&lt;li&gt;&lt;font size="3"&gt;When you upload something, you get the     javascript warning "RadUpload Ajax callback error" as in the attached file (see below), however, the files do     in fact upload just fine apart from that.&lt;/font&gt;&lt;font size="3"&gt;.&lt;/font&gt;&lt;font size="3"&gt; &lt;a href="#q9"&gt;&lt;/font&gt;&lt;font size="3"&gt;see solution&lt;/font&gt;&lt;font size="3"&gt; --&lt;/font&gt;&lt;font size="3"&gt;&amp;gt;&lt;/font&gt;&lt;font size="3"&gt;&lt;/a&gt;&lt;/font&gt; &lt;/ol&gt;  &lt;br&gt;  &lt;font size="4"&gt;&lt;font color="#cc0000"&gt;  &lt;hr&gt;  &lt;br&gt;  &lt;a name="q1"&gt;&lt;/a&gt; Q1:&lt;/font&gt;&lt;/font&gt; I have enabled upload in the admin control panel and set the file size / file extension according to your online help file. I still can't get the upload feature working!          &lt;br&gt;   &lt;br&gt;  &lt;font color="#336600"&gt;&lt;font size="4"&gt;A1:&lt;/font&gt;&lt;/font&gt; Most of the time this problem is due to an incorrect permission setting on this folder: ~/&lt;b&gt;upfiles&lt;/b&gt; (under your forum root dir).      &lt;br&gt;   &lt;br&gt;  Please make sure the &lt;b&gt;Network Service&lt;/b&gt; account has&lt;b&gt; &lt;/b&gt;NTFS&lt;b&gt; &lt;i&gt;Modify&lt;/i&gt; &lt;/b&gt;permission on the ~/&lt;b&gt;upfiles &lt;/b&gt; folder and &lt;b&gt;all its subfolders and files&lt;/b&gt; (make sure you propagate permission). If you grant only &lt;b&gt;Write&lt;/b&gt; permission (instead of &lt;b&gt;Modify&lt;/b&gt;), you will see your uploaded files staying in the &lt;b&gt;upfiles/buffer&lt;/b&gt; directory and download will fail.          &lt;br&gt;   &lt;br&gt;  This folder setting is also required for &lt;b&gt;subscription email notification&lt;/b&gt; to work properly. If you can upload but cannot send subscription, this means you did not PROPAGATE this permission down.     &lt;br&gt;   &lt;br&gt;   &lt;br&gt;  &lt;a href="#qtop"&gt;Back to top&lt;/a&gt;       &lt;br&gt;  &lt;hr&gt;  &lt;br&gt;   &lt;br&gt;  &lt;font size="4"&gt;&lt;font color="#cc0000"&gt;&lt;a name="q2"&gt;&lt;/a&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="4"&gt;&lt;font color="#cc0000"&gt;Q2:&lt;/font&gt;&lt;/font&gt; I get the same &lt;b&gt;permission denied&lt;/b&gt; error when I tried to upload stock avatars via the admin control panel          &lt;br&gt;   &lt;br&gt;  &lt;font color="#336600"&gt;&lt;font size="4"&gt;A2:&lt;/font&gt;&lt;/font&gt; Set &lt;b&gt;Modify&lt;/b&gt; permission for the IUSR and ASP.NET account on the &lt;b&gt;avatars&lt;/b&gt; folder (under your forum root dir).          &lt;br&gt;   &lt;br&gt;   &lt;br&gt;  &lt;a href="#qtop"&gt;Back to top&lt;/a&gt;       &lt;br&gt;  &lt;hr&gt;  &lt;br&gt;   &lt;br&gt;  &lt;font size="4"&gt;&lt;font color="#cc0000"&gt;&lt;a name="q3"&gt;&lt;/a&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="4"&gt;&lt;font color="#cc0000"&gt;Q3:&lt;/font&gt;&lt;/font&gt;  [&lt;b&gt;2.x version&lt;/b&gt;] My server is &lt;b&gt;IIS 6&lt;/b&gt;, and I cannot upload more than 200KB at a time? If I upload more than 200KB of data, I got the following error:           &lt;br&gt;   &lt;br&gt;  &lt;blockquote class="quote"&gt;&lt;div style="width:50%;font-weight:bold; padding-bottom:4px;"&gt;&lt;/div&gt;Request object error &lt;b&gt;'ASP 0104 : 80004005'          &lt;br&gt;   &lt;br&gt;  Operation not Allowed&lt;/b&gt;&lt;/blockquote&gt;          &lt;br&gt;   &lt;br&gt;  which happens at the line that calls the &lt;b&gt;Request.BinaryRead&lt;/b&gt; method.          &lt;br&gt;   &lt;br&gt;  &lt;font color="#336600"&gt;&lt;font size="4"&gt;A3:&lt;/font&gt;&lt;/font&gt;  [&lt;b&gt;2.x version&lt;/b&gt;]The new metabase in IIS 6 has a restriction on the maximum file size ASP script can upload. Do the following to correct this issue (thanks to Ittech for the info)          &lt;br&gt;   &lt;br&gt;  &lt;blockquote class="quote"&gt;&lt;div style="width:50%;font-weight:bold; padding-bottom:4px;"&gt;&lt;/div&gt;Here's the code from the metabase.xml, which you can edit and it applies changes in realtime. Never restarted the forum/site :)           &lt;br&gt;   &lt;br&gt;  Gotta look under the header &amp;lt;IIsWebService Location ="/LM/W3SVC"           &lt;br&gt;   &lt;br&gt;  or for whatever service location site name you are using...           &lt;br&gt;   &lt;br&gt;  Change           &lt;br&gt;  &lt;pre class="code"&gt;AspMaxRequestEntityAllowed="204800"      &lt;/pre class="code"&gt;     &lt;br&gt;  to           &lt;br&gt;  &lt;pre class="code"&gt;AspMaxRequestEntityAllowed="10238976"      &lt;/pre class="code"&gt;     &lt;br&gt;  &lt;/blockquote&gt;          &lt;br&gt;   &lt;br&gt;  You can also refer to &lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/iis/ref_mb_aspmaxrequestentityallowed.asp" target="_blank" rel="nofollow"&gt;this MSDN article&lt;/a&gt;.           &lt;br&gt;   &lt;br&gt;   &lt;br&gt;  &lt;a href="#qtop"&gt;Back to top&lt;/a&gt;       &lt;br&gt;  &lt;hr&gt;  &lt;br&gt;   &lt;br&gt;  &lt;font size="4"&gt;&lt;font color="#cc0000"&gt;&lt;a name="q4"&gt;&lt;/a&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="4"&gt;&lt;font color="#cc0000"&gt;Q4:&lt;/font&gt;&lt;/font&gt; My ASP.NET version doesn't seem to allow uploading more than 4 MB of files. What's wrong?          &lt;br&gt;   &lt;br&gt;  &lt;font color="#336600"&gt;&lt;font size="4"&gt;A4:&lt;/font&gt;&lt;/font&gt; By default, ASP.NET limit the size of the file uploads to about 4MB. To upload large files, and not receive errors or the page stopping while uploading, there are &lt;b&gt;3&lt;/b&gt; settings in the &lt;b&gt;machine.config&lt;/b&gt; and the &lt;b&gt;web.config&lt;/b&gt; files that you need to modify.      &lt;br&gt;   &lt;br&gt;  In &lt;b&gt;your web.config&lt;/b&gt;, add a line under your &amp;lt;system.web&amp;gt;          &lt;br&gt;   &lt;br&gt;  &lt;pre class="code"&gt;&amp;lt;httpRuntime executionTimeout="54000" maxRequestLength="512000" /&amp;gt;       &lt;/pre class="code"&gt;     &lt;br&gt;   &lt;br&gt;  where &lt;i&gt;executionTimeout &lt;/i&gt;is in seconds, and &lt;i&gt;maxRequestLength &lt;/i&gt;is in KB.  &lt;i&gt;executionTimeout &lt;/i&gt;is the amount of time a thread will continue to run, and accept data.  &lt;i&gt;maxRequestLength &lt;/i&gt;is the total amount of data that can be sent through an HTTP Post to the server. The default is 4MB (4096)- this is normally set low so that your server will not be overwhelmed by possible DoS attacks.           &lt;br&gt;   &lt;br&gt;  In your &lt;b&gt;machine.config&lt;/b&gt;, modify &lt;i&gt;responseDeadlockInterval &lt;/i&gt;to equal the same amount of time for executionTimeout.    &lt;i&gt;responseDeadlockInterval &lt;/i&gt;is the amount of time that the Client's browser and Server will continue to communicate. Every several minutes or so, the server polls the client asking if it has more information to send; if it does not receive anything back after several times, then the server stops the current thread and all communication is stopped. This is the cause of the error you may see sometimes.           &lt;br&gt;   &lt;br&gt;  These 3 changes will allow you to successfully upload large files.              &lt;br&gt;   &lt;br&gt;   &lt;br&gt;  &lt;a href="#qtop"&gt;Back to top&lt;/a&gt;       &lt;br&gt;  &lt;hr&gt;  &lt;br&gt;   &lt;br&gt;  &lt;font size="4"&gt;&lt;font color="#cc0000"&gt;&lt;a name="q5"&gt;&lt;/a&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="4"&gt;&lt;font color="#cc0000"&gt;Q5:&lt;/font&gt;&lt;/font&gt; When a user tried to attach a file to a message or upload an image, this error occured          &lt;br&gt;  &lt;blockquote class="quote"&gt;&lt;div style="width:50%;font-weight:bold; padding-bottom:4px;"&gt;&lt;/div&gt;&lt;i&gt;System.IO.DirectoryNotFoundException: Could not find a part of the path "D:\".  &lt;/i&gt;&lt;/blockquote&gt;          &lt;br&gt;   &lt;br&gt;  &lt;font color="#336600"&gt;&lt;font size="4"&gt;A5: &lt;/font&gt;&lt;/font&gt;the software stores uploaded file in the file system, and &lt;b&gt;will attempt to create a folder for each user&lt;/b&gt; before a file is uploaded.           &lt;br&gt;   &lt;br&gt;  Both Directory.CreateDirectory(path) and DirectoryInfo.CreateSubdirectory(path) &lt;b&gt;require the account used by ASP.NET to have Read access to the drive's root directory (i.e. &amp;lt;Drive&amp;gt;:\). &lt;/b&gt;          &lt;br&gt;   &lt;br&gt;  So, you need to grant &lt;b&gt;Network Service&lt;/b&gt; "Read" access to the drive's root folder (D:\ in this case).          &lt;br&gt;   &lt;br&gt;   &lt;br&gt;  &lt;a href="#qtop"&gt;Back to top&lt;/a&gt;       &lt;br&gt;  &lt;hr&gt;  &lt;br&gt;   &lt;br&gt;  &lt;font size="4"&gt;&lt;font color="#cc0000"&gt;&lt;a name="q6"&gt;&lt;/a&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="4"&gt;&lt;font color="#cc0000"&gt;Q6:&lt;/font&gt;&lt;/font&gt; What settings do I have to set to prevent people from executing malicious code on my server if I decide to enable upload for the forum?          &lt;br&gt;   &lt;br&gt;  &lt;font color="#336600"&gt;&lt;font size="4"&gt;A6:&lt;/font&gt;&lt;/font&gt; It is very easy. The basic idea is to disable both 1) parent path access on your site or web application and 2) script execution permission on the &lt;b&gt;upfiles &lt;/b&gt; folder. The following FAQ tells you exactly what to do with 2 screen shots:          &lt;br&gt;   &lt;br&gt;  &lt;a href="http://www.aspplayground.net/forum/m_376885/tm.htm" target="_blank" rel="nofollow"&gt;Disable script execution for the upfiles folder&lt;/a&gt;          &lt;br&gt;   &lt;br&gt;   &lt;br&gt;  &lt;a href="#qtop"&gt;Back to top&lt;/a&gt;       &lt;br&gt;  &lt;hr&gt;  &lt;br&gt;   &lt;br&gt;  &lt;font size="4"&gt;&lt;font color="#cc0000"&gt;&lt;a name="q7"&gt;&lt;/a&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#cc0000"&gt;&lt;font size="4"&gt;Q7:&lt;/font&gt;&lt;/font&gt; We updated from the ASP version to the new ASP.NET version and now &lt;b&gt;new users are not able to upload/embed images with their posts&lt;/b&gt;. All older user can, but just new users cannot. Since old users can upload it doesn't appear to be an uploads directory permission problem. Any ideas? Thanks.          &lt;br&gt;   &lt;br&gt;  &lt;font color="#336600"&gt;&lt;font size="4"&gt;A7: &lt;/font&gt;&lt;/font&gt;This is what happened: the uploaded file is stored in a folder with your member ID as the name under the folder &lt;b&gt;upfiles&lt;/b&gt;. What this means is that when a user (e.g. member Id = 3290) tries to upload a file, the software has to first create a folder named 3290 under &lt;b&gt;upfiles,&lt;/b&gt; and then move the uploaded file to the folder.      &lt;br&gt;   &lt;br&gt;  So, after your upgrade, you forgot to change the permission for the ~/&lt;b&gt;upfiles &lt;/b&gt;folder to allow &lt;b&gt;ASP.NET&lt;/b&gt; to create folders and this caused problem to new users.      &lt;br&gt;   &lt;br&gt;  Why does it work for existing users? because there had already been folders with their member ID's before you upgraded the software, and the permission for ~/&lt;b&gt;upfiles&lt;/b&gt; was set correctly before.          &lt;br&gt;   &lt;br&gt;  Solution: see &lt;a href="#q1"&gt;A1&lt;/a&gt; above          &lt;br&gt;   &lt;br&gt;   &lt;br&gt;  &lt;a href="#qtop"&gt;Back to top&lt;/a&gt;       &lt;br&gt;  &lt;hr&gt;  &lt;br&gt;  &lt;font size="4"&gt;&lt;font color="#cc0000"&gt;&lt;a name="q8"&gt;&lt;/a&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="4"&gt;&lt;font color="#cc0000"&gt;Q8:&lt;/font&gt;&lt;/font&gt;  [&lt;b&gt;2.x version&lt;/b&gt;] Users uploaded avatars via their profile pages but the avatars didn't seem to be saved correctly (404 not found when clicking on the picture icon).      &lt;br&gt;   &lt;br&gt;  I've noted that user uploaded avatars ARE getting stored in the ~/&lt;b&gt;upfiles/buffer&lt;/b&gt; folder. Is that the permanent location of a user's uploaded avatar? If not, what could be the problem with the avatar not displaying?          &lt;br&gt;   &lt;br&gt;  &lt;font color="#336600"&gt;&lt;font size="4"&gt;A8:&lt;/font&gt;&lt;/font&gt; Avatars are first stored in the buffer folder and once the user click on OK/Apply on the profile page (not the upload window), the avatar will be moved to its final location, that is the folder with the member ID as the name.          &lt;br&gt;   &lt;br&gt;   &lt;br&gt;  &lt;a href="#qtop"&gt;Back to top&lt;/a&gt;       &lt;br&gt;  &lt;hr&gt;  &lt;br&gt;   &lt;br&gt;  &lt;font size="2"&gt;&lt;/font&gt;&lt;font size="4"&gt;&lt;font color="#cc0000"&gt;&lt;a name="q9"&gt;&lt;/a&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="4"&gt;&lt;font color="#cc0000"&gt;Q9:&lt;/font&gt;&lt;/font&gt;When you upload something, you get the javascript warning "RadUpload Ajax callback error" as in the attached file (see below), however, the files do in fact upload just fine apart from that.. &lt;br&gt;   &lt;br&gt;  &lt;font color="#336600"&gt;&lt;font size="4"&gt;A9:&lt;/font&gt;&lt;/font&gt; check &lt;a href="http://www.aspplayground.net/forum/Adding-Upload-Progress-bar-m399460.aspx" target="_blank" rel="nofollow"&gt;this page&lt;/a&gt; out. &lt;br&gt;   &lt;br&gt;   &lt;br&gt;  &lt;a href="#qtop"&gt;Back to top&lt;/a&gt;       &lt;br&gt;   &lt;br&gt;   &lt;br&gt;  </description><link>http://www.aspplayground.net/forum/fb.ashx?m=376095</link><pubDate>Tue, 04 Mar 2003 19:05:43 GMT</pubDate></item></channel></rss>