在将文件保存到文件夹之前,我需要重命名pdf名称,并添加前缀雇主名称 [英] before saving the file in the folder i need to rename the pdf name adding with prefix the employer name

查看:128
本文介绍了在将文件保存到文件夹之前,我需要重命名pdf名称,并添加前缀雇主名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有代码上传文件并将其保存到文件夹中但在将文件保存到文件夹之前我需要重命名pdf名称,并在前缀中添加雇主名称,以便如何完成。



  string  fileName = Path.GetFileName(FileUpload1.PostedFile.FileName); 
FileUpload1.PostedFile.SaveAs(Server.MapPath( 〜/ Documents /)+文件名);
obj.path = fileName;







i想要以这种格式保存文件:





101_Resume_Resume.pdf .....> Employeer id_Filename_File

解决方案

您可以在保存之前更改文件名。



  string  fileName = Path.GetFileName(FileUpload1.PostedFile.FileName); 
filename = Employerid + _ + filename;
FileUpload1.PostedFile.SaveAs(Server.MapPath( 〜/ Documents /)+文件名);


i have the code to upload the file and save it in to the folder but before saving the file in the folder i need to rename the pdf name adding with prefix the employer name how it can be done.

string fileName = Path.GetFileName(FileUpload1.PostedFile.FileName);
       FileUpload1.PostedFile.SaveAs(Server.MapPath("~/Documents/") + fileName);
       obj.path = fileName;




i want the file to be saved in this format :


101_Resume_Resume.pdf..... > Employeer id_Filename_File

解决方案

you can change your filename before saving it.

string fileName = Path.GetFileName(FileUpload1.PostedFile.FileName);
filename= Employerid + "_" + filename;
FileUpload1.PostedFile.SaveAs(Server.MapPath("~/Documents/") + fileName);


这篇关于在将文件保存到文件夹之前,我需要重命名pdf名称,并添加前缀雇主名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆