473,385 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Problem uploading file on server

hi everybody,

I am trying to upload a file on server using fileupload control in asp.net 3.5.
On local machine code is working fine, but when uploaded on server, it gives
exception as :
Exception Access to the path 'D:\hostingcont\march2010\abc\abc.com\www\attachme nts\abc.jpg' is denied.

I tried to set permission on attachments folder to (777) but when doing this server responds unrecognized chmod.

please help me as soon as possible
May 19 '10 #1
3 1503
Frinavale
9,735 Expert Mod 8TB
Well first of all chmod is a Linux/Unix command that changes the permission settings. ASP.NET applications have to be hosted in a Windows environment...There is no chmod command in Windows.

The other thing is that you are trying to access a drive "D:\"....are you Sure that your application has access to this??

Consider using the Server.MapPath() function to save your file into a folder within your web application instead of trying to access a drive that may or may not exist.

-Frinny
May 19 '10 #2
@Frinavale
hi Frinny,

Thanks for reply, as you said I am using Server.MapPath(), the location "D:\".. is generated when exception occurs, here is code:
Expand|Select|Wrap|Line Numbers
  1.  if (fileUploadAttach.HasFile)
  2.                     {
  3.  
  4.  
  5.  
  6.                       string  strFileName = Path.GetFileName(fileUploadAttach.PostedFile.FileName);
  7.  
  8.  
  9.                         fileUploadAttach.PostedFile.SaveAs(Server.MapPath("~/attachments/"+strFileName));
  10.  
  11.  
  12.                     }
please help how to resolve the problem
thanks
May 20 '10 #3
Frinavale
9,735 Expert Mod 8TB
Are you the server administrator?

If you aren't you will have to talk to the administrator and let them know that your application has to be allowed to write to a folder within your website.

-Frinny
May 20 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Mike | last post by:
Hi i have a problem in asp.ne i am uploading file to the server using htmlinput controls and every thing is o but i try to upload larger file to the server like more than 4 mb and about 10mb i got...
6
by: jackson | last post by:
Hi all, Im having problem when uploading file to localhost. but I can upload to drive c: any idea thanks
0
by: Monica | last post by:
I have a problem with uploading file into SQL 2005 DB using IIS 6.0 webserver, this code was working in SQL 2000 Db and IIS 5.0. Can you please help me to see what the problem is. Error msg :...
1
by: wenqiang7 | last post by:
I am encountering a very strang problem with file uploading in my ASP.Net page. When we try to upload certain file, we'll get an error msg of "Cannot find server or DNS Error". We are running...
0
by: Mika M | last post by:
Hi! I'm uploading file(s) over internet like... My.Computer.Network.UploadFile("C:\file1.txt", "ftp://some.domain.com/file1.txt", "MyUID", "MyPWD", False, 1000) ....and this is working...
1
by: Nerry | last post by:
Hello everyone, I have ASP webpages, but I have a problem uploading my images via ftp, keep getting an error: An error occurred copying a file to the ftp server. Make sure you have permissions...
1
by: =?Utf-8?B?ZGF2ZWg0Mg==?= | last post by:
Hi, We want to upload a file to a business partner using FTP with SSL from our intranet. Our proof of concept solution in VB uses FtpWebRequest based on an example at...
4
by: ish | last post by:
hello everybody...... plz help me out... how we can store the acual path of uploading file.i want to store the path of file in my database...bt i m not getting anyway to implement that......if...
11
by: starter08 | last post by:
Hi, I have a C++ function which sends a post request to a server for uploading a file. I have also written a server side cgi to receive the data and create the file in a specified directory. The...
7
by: nwclark | last post by:
Ok... I have a noobie issue. I am trying to upload a photo to specific directory on my server. (this is working correctly with the code below). However, I am also trying to rename the file and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.