FileUpload can't upload to folder

Last post 06-25-2008 7:22 AM by anupalavila. 14 replies.

Sort Posts:

  • FileUpload can't upload to folder

    11-07-2007, 10:38 PM
    • Loading...
    • bbaxter
    • Joined on 02-15-2007, 11:49 PM
    • ATX
    • Posts 364

    Hi, I have a godaddy account that I've uploaded my site too. When I try to use the fileupload tool I get the following error:

    Access to the path 'd:\hosting\username\UserFiles\thumb2.GIF' is denied.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.UnauthorizedAccessException: Access to the path 'd:\hosting\bbaxter83\UserFiles\thumb2.GIF' is denied.

    ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

    To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [UnauthorizedAccessException: Access to the path 'd:\hosting\bbaxter83\UserFiles\thumb2.GIF' is denied.]
    System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +1971539
    System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +998
    System.IO.FileStream..ctor(String path, FileMode mode) +65
    System.Web.HttpPostedFile.SaveAs(String filename) +87
    System.Web.UI.WebControls.FileUpload.SaveAs(String filename) +22
    admin_Default.PreviewImageClick(Object sender, EventArgs e) +201
    System.EventHandler.Invoke(Object sender, EventArgs e) +0
    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
     

    It works fine locally. Is this a permissions issue? I tried using smartFTP to change the permissions but it didnt let me (I think chmod is only in unix systems, right?) 

    Is there a way to grant write access to this folder in asp via web config, etc, or is this something I need to contact godaddy about? 

    keepin' it real in the ATX.
  • Re: FileUpload can't upload to folder

    11-07-2007, 11:36 PM
    Answer
    • Loading...
    • docluv
    • Joined on 06-29-2002, 7:16 PM
    • Willow Spring NC
    • Posts 1,520
    • ASPInsiders
      TrustedFriends-MVPs

    You need to have write permission set on your server for this folder for the ASP.NET account.

  • Re: FileUpload can't upload to folder

    11-07-2007, 11:41 PM
    Answer
    • Loading...
    • binobose
    • Joined on 10-23-2007, 8:42 AM
    • India
    • Posts 151

    The given folder where ur gif files are residing is not having read/write permission. in this case what u need to do is set these permissions to the folder for  ASP.Net account.

    Cheers
    Bino
    www.codepal.co.in
    Filed under:
  • Re: FileUpload can't upload to folder

    11-08-2007, 2:04 AM
    • Loading...
    • bp47580
    • Joined on 08-07-2007, 9:19 AM
    • Posts 116

    the path u have given should be a shared path.

    otherwise file can not be uploaded

    so make that folder a shared one.(i.e-userfiles)

    then try. let me know then...

  • Re: FileUpload can't upload to folder

    11-08-2007, 11:34 AM
    • Loading...
    • bbaxter
    • Joined on 02-15-2007, 11:49 PM
    • ATX
    • Posts 364

    So what would the shared path be? I'm not sure I understand the difference between shared and the physical path above ( I used server.mappath)

    and if it is a permissions issue can I change the permissions in asp? how? 

    keepin' it real in the ATX.
  • Re: FileUpload can't upload to folder

    11-08-2007, 11:52 AM
    • Loading...
    • docluv
    • Joined on 06-29-2002, 7:16 PM
    • Willow Spring NC
    • Posts 1,520
    • ASPInsiders
      TrustedFriends-MVPs

    You have to save to the physical path, ie C:\inetpub\wwwroot\mysite for example.

    You can get the physical path to your site via Request.PhysicalApplicationPath

  • Re: FileUpload can't upload to folder

    11-08-2007, 12:00 PM
    • Loading...
    • Haissam
    • Joined on 10-05-2006, 2:25 AM
    • Beirut - Lebanon
    • Posts 5,227

    If your application is hosted under Windows 2000 server, on the UserFiles folder give the ASPNET account read/write permission by right clicking on the folder, select the Security Tab, locate the ASPNET user and check the read and write permission. if you are running under window 2003 server use the NETWORK SERVICE account.

    HC

    Haissam Abdul Malak
    MCAD.NET
    | Blog |
  • Re: FileUpload can't upload to folder

    12-04-2007, 12:37 PM
    • Loading...
    • donperry
    • Joined on 03-12-2007, 3:24 PM
    • Posts 11

    How do i give write permission to a folder using godaddy?

    i cant seem to find the answer anywhere on the net 

  • Re: FileUpload can't upload to folder

    12-05-2007, 12:11 AM
    • Loading...
    • bp47580
    • Joined on 08-07-2007, 9:19 AM
    • Posts 116

    just right click on that folder..
    go to security tab
    then select location, then add local,aspnet,network and give all permissions to all of them.
    if u struct at any poin then reply back..

  • Re: FileUpload can't upload to folder

    12-05-2007, 11:01 AM
    • Loading...
    • bbaxter
    • Joined on 02-15-2007, 11:49 PM
    • ATX
    • Posts 364

    I anyone is using godaddy and has this problem you have to create a new directory from the control panel and set it's r/w/e to true, I believe its under directory management, you can't create the folder from an ftp client and set the directory specs.

    keepin' it real in the ATX.
  • Re: FileUpload can't upload to folder

    01-30-2008, 7:54 AM
    • Loading...
    • CSbeginner
    • Joined on 08-01-2006, 5:56 AM
    • Posts 16

    i know that this reply come little late, but for anyone who experience the same problem:

     in your hosting control panel go to the file manager, from there mark the folder's  you like to affect, and click the permissions tab. and select the "write" permission .

    P.S using the "Request.PhysicalApplicationPath" as was sudjested above, will also allow you to delete files on the folder.

  • Re: FileUpload can't upload to folder

    03-31-2008, 5:11 PM

    That was 99% of it, CSBeginner.

    I just suffered through the same pain of getting FileUpload to work on a GoDaddy hosting account and the (somewhat) missing component in your instructions is that you need to TICK the checkbox next to the directory in question, at which point an icon titled "Permissions" appears in the list of icons across the top. With your directory ticked, you then get into a "Set Permissions for selected folders" area where you MUST un-tick the current (default) of "Inherit" at which point you can THEN tick both the "Write" and "Read" boxes. (Without "Read" any of your pages which reference files in this directory will get a sign-in challenge!)

    Once you have both READ and WRITE permission for the directory into which you want to "toss" files, it works just as it does on your local system: you get the Path to "here" and then append the directory name (without a "/" or "\") and now you're cookin!

    I hope this helps ... GoDaddy is a terrific hosting bargain. It's unfortunate that their documentation is fairly horrid, but their tech service guys (and gals) are, for the most part, terrific at what they do (IMHO).

    Mahalos (thanks) for the pointer which got me headed in the right direction!

    :) KevInKauai

    Filed under: ,
  • Re: FileUpload can't upload to folder

    05-23-2008, 4:12 AM

    Hi Mr. KevInKauai,

    I can't seem to get the the icon titled "permissions" after I tick on the check box. I have a screen capture below. Am I doing sonething wrong? Thanks

  • Re: FileUpload can't upload to folder

    05-23-2008, 5:49 AM

    I got it. Thanks

  • Re: FileUpload can't upload to folder

    06-25-2008, 7:22 AM
    • Loading...
    • anupalavila
    • Joined on 01-03-2008, 11:25 AM
    • Kerala
    • Posts 140

     Thanks this post helped me a lot

    Regards
    Anu Palavila
Page 1 of 1 (15 items)