I am trying to use fileupload tag to upload a file. What it basically does is, it saves the file into the follwoing directory:
C:\Program Files\Common Files\Microsoft Shared\DevServer\10.0\
Can someone please tell me how to change this path and save the upload file into some other directory?
You have the complete control of this. If you want to the file saved to a different path, then use this :
fileUpload.PostedFile.SaveAs("c:\my path\" + fileUpload.FileName);
Make sure it (folder) has permissions
FileUpload1.SaveAs(savePath);
read more about FileUpload.SaveAs Method
Related
There are two files c:/a/b/mycode.r and c:/a/myfunction.r on my drive. When I run mycode.r, how to read the myfunction.r by using the relative path with source()? I tried source("../myfunction.r"), but it says No such file or directory. How to solve this problem?
Try to set chdir=TRUE.
This will change the working directory to the directory of the file being sourced.
`source("../myfunction.r", chdir=TRUE)`
I have a problem when, I try to open a Jar File with JD-GUI Decompiler, the error is the following.
This error don't let me decompile the jar.
To solve this problem, I did the following.
Change the extension jar file to RAR file or another compressed format.
Uncompresed the file.
Open some file class inside the folder mentioned above with JD-GUI
Finally in JD-GUI tool, choose the option File -> Save all Resources
I need assistance, how would I change the directory name from download to C:\Users\sesethu.faku\Desktop\assetManagementFiles to save files downloaded?
your path would look like Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "/assetManagementFiles"
I am using Choose File keyword to upload file. In documentation is written that I can use ${CURDIR} to set the path to my file, but it means that this file has to be in the same directory ${CURDIR}/filename.txt. But how to set the path to the file that exists in another directory?
Use ${EXECDIR} so you go back to the root and go from there.
I am processing some CSV file which i have copied in Bin folder of My ASP.NET Website.
When i execute
using (IDataReader csv = new CsvReader
(new StreamReader("sample.txt"), true, '|'))
{
.....
}
it complains me that "sample.txt" not found in "c:\Program Files\.....\"
Won't the runtime automatically look into the bin folder?
what modification do i need to do?
You need to specify a full path by calling Server.MapPath:
new StreamReader(Server.MapPath(#"~/bin/sample.txt"))
However, you should not put anything in the bin folder other than assemblies.
You should use the App_Data folder instead.