c# - How to save uploaded file in different name with actual physical path in asp.net? -
i have file upload in code. want save file in different name (i.e patient id + timestamp) not save uploaded file in actual physical location. shows format not correct.
here location , deptcode taken session.and mainpath taken variable defined in web.config. thats base path. base path creating sub folders not there , have save uploaded file in different name. values correct.even create subfolders if not there ,but problem saveas line. cannot save uploaded file. here if use saveas(server.mappath(..)) shows u should use virtual path. if use saveas(filelocation) shows format wrong..please me..
string timestamp = datetime.now.tostring();
return thing 5/15/2013 10:14:18 am
. window folder , file can not contain following characters: \ / : * ? " < > |
, datetime.now
returing 1 of this character : , /
why giving error.remove :
datetime.now.tostring().replace(':','-').replace('/','-');
think work.
Comments
Post a Comment