Click here to Skip to main content
15,907,392 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
i have input type="file" which i use to select image and save in my user defined folder...

also i add new input type file from jquery (append) ...and use same procedure to save in folder..

but if i save using asp.net's file.copy or file.move, it gives error as



Could not find file 'C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\thumb9.jpg'.


I selected from image thumb9.jpg from folder and want to save as

C#
dayimagenew = Request.Files[DayImage1].FileName;
                   File.Move(dayimagenew, "D://SelImg/Test.jpg");



but the above is giving error
Posted

1 solution

You should pass the full path with the fileName as well in the File.Move method for the source too.

Check this for a reference

Refer[^]
 
Share this answer
 
v2
Comments
maulikshah1990 29-Jan-14 2:42am    
hihow can i have full path of image selected from input type file .
pls advice
JoCodes 29-Jan-14 3:53am    
In the link provided , you can see the path provided. it can be path on the local drive or even you can use Server.MapPath too.
maulikshah1990 29-Jan-14 4:15am    
did u understand my question.........
JoCodes 29-Jan-14 4:20am    
When you try to move a file from one folder to another , exception throws could not find file. Thats your question?Correct me if I understood wrong?
maulikshah1990 29-Jan-14 4:23am    
yes..u are right..but if i use <asp:FileUpload> , it saves image to the folder..and if i use input type file , it gives error....

and i cannot use asp:Fileupload, because i append input type=file from jquery ....

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