Change file names before uploading with SWFUpload

做~自己de王妃 提交于 2019-12-11 08:27:01

问题


I am using SWFUpload to allow users to upload multiple files in any browser. A user can provide custom file names for the files being uploaded. How can I iterate through all the queued files and update the name of the file to the custom name before the file is uploaded.

If I can't change the file name, how do I add a post parameter to each file being uploaded to make the change on the server side? I know how to add parameters for all files but how would I do it for each file?


回答1:


You can't update the actual name of the file that gets sent in the POST body of the file upload because internally, SWFUpload is using a FileReference which doesn't let you change any of the file's properties before uploading it (and there's no way to get proper upload progress without using a FileReference to do the uploading, so this isn't something that can really be changed).

However, you should be able to add an extra POST parameter per file via the addFileParam function. Its signature is:

addFileParam(file_id:String, name:String, value:String):Boolean


来源:https://stackoverflow.com/questions/10291754/change-file-names-before-uploading-with-swfupload

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!