c# - Posted files not able to get the file name with path -
the problem having on when compile , run locally works fine (i.e "file.filename" give me file file name path) when run same code local iis doesnt work (i.e "file.filename" give me file name). can please tell me whats going on.
foreach (string inputtagname in request.files) { httppostedfilebase file = request.files[inputtagname]; //file file; if (file.contentlength > 0) { string filepath = file.filename; .......... } ........ }
msdn says:
when overridden in derived class, gets qualified name of file on client.
if want save file, following might help, inside if check.
var filename = path.combine(request.mappath("~/app_data"), path.getfilename(file.filename)); file.saveas(filename);
Comments
Post a Comment