Click here to Skip to main content
15,860,859 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

we have a asp and javascript code snipet which we are using to upload files via online application.
currently we are facing an issue like the application is allowing us to upload a file from E/F drive but not allowing us to upload from C drive.
application throwing an alert message as File not exist or access denied...

ASP CODE SNIPET
JavaScript
case "FileExist"
	sFileName	= Request.QueryString("FileName")
		Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

		If objFSO.FileExists(sFileName) = true then
			sResult = "Success"
		Else
			sResult = "Not Success"
		End If
		Set objFSO = Nothing
Java script code
		for (var i=1; i<=(document.getElementById('tblFile').rows.length)-1; i++)	
		{			
			if (IsEmpty('cmdBrowse' + i, 'SELECT', 'File', 'Y') == false)
    	return false;

			sFileName = escape(document.getElementById('cmdBrowse' + i).value).replace(gSpecialChar,'%2b');
     	var sURL = "../ADO_Common.asp?PurposeName=FileExist&FileName=" + sFileName;
   //    alert(sURL);	  
			oXMLHTTP.open( "POST", sURL, false );
			oXMLHTTP.send();	     
			if (oXMLHTTP.responseText != "Success")
			{
				alert("File Does Not Exists Or Permission Denied...")
				return false;								
			}		
		}	

Please help me on this to resolve this issue...
Posted
Updated 8-May-12 22:34pm
v2

1 solution

When you are using IIS, the permissions granted to IUSR_machinename is important for such scenarios.
If you do not have write permission to the C drive for IUSR_machinename, an error will occur in the above script.

Same thing discussed/explained here: Using the FileSystemObject to Write to Text Files [^]

In case, the requests are impersonated, then you need to make sure that the user impersonated has the security permissions.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900