重命名用户上传 javascript 的文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16569620/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
rename file that user uploads javascript
提问by user1571352
I have the following html on a form:
我在表单上有以下 html:
<input type="file" name="uploadField" />
When users click on the browse button they can select any file but I want to rename the file using the value of another field on the form
当用户单击浏览按钮时,他们可以选择任何文件,但我想使用表单上另一个字段的值重命名文件
I have a submit button. Can I do it here?
我有一个提交按钮。我可以在这里做吗?
回答by Darin Dimitrov
Can I do it here?
我可以在这里做吗?
No, for security reasons you have no control of this on the client. You can rename the file on the server when it gets uploaded.
不,出于安全原因,您无法控制客户端。您可以在上传文件时重命名服务器上的文件。
回答by Muhammad Ramahy
for security reasons you cannot do such thing i.e. manipulate multipart file or file to be uploaded do that on server
出于安全原因,您不能这样做,即操作多部分文件或要上传的文件在服务器上执行此操作