Locked[FAQ]Upload does not work!

Author
APGvNext Sam
vNext Dev
  • Total Posts : 13229
  • Joined: 2001/05/23 00:00:00
  • Status: offline
2003/03/04 19:05:43 (permalink) 3.x

Upload does not work!

NOTE: Part of this Q & A applies to the 2.x version (whenever you see reference to ASP in a Q). However, the answers applies to all versions.

  1. 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!
  2. I get the same permission denied error when I tried to upload stock avatars via the admin control panel.
  3. 2.x version My server is IIS 6, and I cannot upload more than 200KB at a time.
  4. My forum doesn't seem to allow uploading more than 4 MB of files.
  5. When a user tried to attach a file to a message or upload an image, this error occurred:
    System.IO.DirectoryNotFoundException: Could not find a part of the path "D:\". 
  6. 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?
  7. New users are not able to upload/embed images with their posts. All older user can, but just new users cannot.
  8. [2.x version] Users uploaded avatars via their profile pages but the avatars didn't seem to be saved correctly.
  9. 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.. 
  10. When users click on the "select" button beside the file box, nothing happens (no file selection dialog)
 


Q1:
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!

A1: Most of the time this problem is due to an incorrect permission setting on this folder: ~/upfiles (under your forum root dir).

Please make sure the ASP.NET account hasNTFS Modify permission on the ~/upfiles folder and all its subfolders and files (make sure you propagate permission when setting this up.) Your ASP.NET account may not be the default account (Network Service) if you are on IIS 7 or later. It will be the account used by your Application Pool. You can find the name of the account on the System Related Options -> Server Checker page in the AdminCP.
 
If you grant only Write permission (instead of Modify) for ASP.NET on ~/upfiles/, you will see your uploaded files staying in the ~/upfiles/buffer directory and download will fail.

This folder setting is also required for subscription email notification to work properly. If you can upload but cannot send subscription, it means you did not PROPAGATE this permission down the folder hierarchy.



NOTE: as you see, there are only 4 groups / users set for ~/upfiles. You don't need any additional groups / users on this folder at all, and the correct permissions are:
  1. Everyone group: Read & Execute;
  2. Administrators group: Full Control;
  3. SYSTEM: Full Control;
  4. NETWORK SERVICE: Modify.


If somehow you are unable to manage or propagate permission for certain files / folder under ~/upfiles (like the license.config file), you may need to take ownership of the file / folder first as there are currently some permission conflicts (from previous OS setup, e.g.).

See screenshot below for more info.



Here is a very good explanation of why you may need to do the step above.

Finally, our Server Checker in the Admin CP checks the permission of the folder based on one file, ~/upfiles/license.config, and it fails if this file cannot be overwritten. So, it is possible that permission is correct on everything else but this file (for some unknown reason).
 
If you suspect this could be the reason why the server checker keeps failing, you can FTP a fresh license.config file (through Option 1 in the Software Activation page in the AdminCP, or you can download a new trial license.config) to overwrite the existing one on the server, and run the Server Checker again.
 
Back to top


Q2:
I get the same permission denied error when I tried to upload stock avatars via the admin control panel

A2: Set Modify permission for the IUSR and ASP.NET account on the avatars folder (under your forum root dir).


Back to top


Q3:
[2.x version] My server is IIS 6, and I cannot upload more than 200KB at a time? If I upload more than 200KB of data, I got the following error:

Request object error 'ASP 0104 : 80004005'

Operation not Allowed


which happens at the line that calls the Request.BinaryRead method.

A3: [2.x version]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)

Here's the code from the metabase.xml, which you can edit and it applies changes in realtime. Never restarted the forum/site :)

Gotta look under the header <IIsWebService Location ="/LM/W3SVC"

or for whatever service location site name you are using...

Change
AspMaxRequestEntityAllowed="204800" 

to
AspMaxRequestEntityAllowed="10238976" 



You can also refer to this MSDN article.


Back to top


Q4: My ASP.NET version doesn't seem to allow uploading more than 4 MB of files. What's wrong?

A4: 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 3 settings in the machine.config and the web.config files that you need to modify.

In your web.config, add a line under your <system.web>

<httpRuntime executionTimeout="54000" maxRequestLength="512000" /> 


where executionTimeout is in seconds, and maxRequestLength is in KB. executionTimeout is the amount of time a thread will continue to run, and accept data. maxRequestLength 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.

In your machine.config, modify responseDeadlockInterval to equal the same amount of time for executionTimeout. responseDeadlockInterval 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.

These 3 changes will allow you to successfully upload large files.


Back to top


Q5:
When a user tried to attach a file to a message or upload an image, this error occured
System.IO.DirectoryNotFoundException: Could not find a part of the path "D:\".


A5: the software stores uploaded file in the file system, and will attempt to create a folder for each user before a file is uploaded.

Both Directory.CreateDirectory(path) and DirectoryInfo.CreateSubdirectory(path) require the account used by ASP.NET to have Read access to the drive's root directory (i.e. <Drive>:\).

So, you need to grant Network Service "Read" access to the drive's root folder (D:\ in this case).


Back to top


Q6:
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?

A6: 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 upfiles folder. The following FAQ tells you exactly what to do with 2 screen shots:

Disable script execution for the upfiles folder


Back to top


Q7:
We updated from the ASP version to the new ASP.NET version and now new users are not able to upload/embed images with their posts. 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.

A7: This is what happened: the uploaded file is stored in a folder with your member ID as the name under the folder upfiles. 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 upfiles, and then move the uploaded file to the folder.

So, after your upgrade, you forgot to change the permission for the ~/upfiles folder to allow ASP.NET to create folders and this caused problem to new users.

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 ~/upfiles was set correctly before.

Solution: see A1 above


Back to top


Q8:
[2.x version] 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).

I've noted that user uploaded avatars ARE getting stored in the ~/upfiles/buffer folder. Is that the permanent location of a user's uploaded avatar? If not, what could be the problem with the avatar not displaying?

A8: 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.


Back to top


Q9: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..



A9: check this page out.

Back to top


Q10: When users click on the "select" button beside the file box, nothing happens (no file selection dialog)
 
A10: There could be some CSS conflicts in your theme, but you can edit the skin file that controls the upload control to easily solve the problem:

Inside ~/App_Themes/Theme_Name/Prom.skin,

look for

<telerik:RadUpload runat="server" skin="Vista" ControlObjectsVisibility="None" 
    OverwriteExistingFiles="true" Width="250px" inputsize="50" Enablefileinputskinning="true" ReadOnlyFileInputs="true" />

Change it to

<telerik:RadUpload runat="server" skin="Vista" ControlObjectsVisibility="None" 
    OverwriteExistingFiles="true" Width="250px" inputsize="50" Enablefileinputskinning="false" ReadOnlyFileInputs="true" />

This should solve the issue.
 
Back to top
post edited by Samuel - 2013/02/23 12:47:34

Attached Image(s)

#1
Jump to:
© 2020 APG vNext Commercial Version 5.5