Asp classic 使用uploadify重命名文件
我正在使用uploadify和asp,我想将文件名更改为文件完成时的当前日期+时间 有什么办法吗 这是我的JS代码:Asp classic 使用uploadify重命名文件,asp-classic,uploadify,http-upload,Asp Classic,Uploadify,Http Upload,我正在使用uploadify和asp,我想将文件名更改为文件完成时的当前日期+时间 有什么办法吗 这是我的JS代码: $('#fileUploadJquery').uploadify({ 'uploader' : 'Shared/ClientScripts/Uploadify/uploadify.swf', 'cancelImg' : 'Shared/ClientScripts/Uploadify/cancel.png', 'rollover' : fal
$('#fileUploadJquery').uploadify({
'uploader' : 'Shared/ClientScripts/Uploadify/uploadify.swf',
'cancelImg' : 'Shared/ClientScripts/Uploadify/cancel.png',
'rollover' : false,
'script' : 'Shared/ClientScripts/Uploadify/upload.asp',
'folder' : 'Uploads',
'fileDesc' : 'Image Files',
'fileExt' : '*.jpg;*.gif;*.bmp;*.png',
'auto' : true,
'wmode' : 'transparent',
onComplete : function (event, queueID, fileObj, response, data) {
//$('#fileUpload').val(fileObj.name);
alert(queueID)
}
请注意我使用uploadify直接从浏览器上传到S3。我想知道有一种方法可以告诉S3给传入的文件命名,而不是用户本地计算机上的名称。我使用uploadify直接从浏览器上传到S3。我想知道有一种方法可以告诉S3将传入文件命名为用户本地计算机上的名称以外的其他名称。您可能需要查看ScriptManager.RegisterClientScriptBlock 将其放置在codebehind上,并在重命名服务器上的文件后调用该函数。这将调用客户端JavaScript javascriptFunctionName,它将提供新的文件名以供上传。下面是一些C:
public void YourFunction(string fileName)
{
ScriptManager.RegisterClientScriptBlock(
ctrlName,
ctrlName.GetType(),
"scriptkey",
@"javascriptFunctionName('" + fileName + @"');",
true);
}
希望这对你有所帮助。当您使用ScriptManager时,它与AJAX结合使用,并在codebehind完成处理后通知Javascript函数 您可能需要查看ScriptManager.RegisterClientScriptBlock 将其放置在codebehind上,并在重命名服务器上的文件后调用该函数。这将调用客户端JavaScript javascriptFunctionName,它将提供新的文件名以供上传。下面是一些C:
public void YourFunction(string fileName)
{
ScriptManager.RegisterClientScriptBlock(
ctrlName,
ctrlName.GetType(),
"scriptkey",
@"javascriptFunctionName('" + fileName + @"');",
true);
}
希望这对你有所帮助。当您使用ScriptManager时,它与AJAX结合使用,并在codebehind完成处理后通知Javascript函数 您需要在服务器脚本中执行文件操作。下面是一个例子:
''// I'm using this component, but any component must work
dim theForm
set theForm = Server.CreateObject("ABCUpload4.XForm")
theForm.Overwrite = True
theForm.MaxUploadSize = 1000000
''// FileData is the name Uploadify gives the post value containing the file
dim theField
set theField = theForm("FileData")(1)
If theField.FileExists Then
''// Renamed the file adding a "random" string in front of the name
dim FileName
FileName = replace(trim(cdbl(now())), ".", "_") + "_" + theField.FileName
theForm.AbsolutePath = True
theField.Save Server.MapPath("../uploadedfiles") & "/" + FileName
''// Some browser need this
Response.write "<html><head><title>File uploaded</title></head><body>File uploaded</body></html>"
End If
您需要在服务器脚本中执行文件操作。下面是一个例子:
''// I'm using this component, but any component must work
dim theForm
set theForm = Server.CreateObject("ABCUpload4.XForm")
theForm.Overwrite = True
theForm.MaxUploadSize = 1000000
''// FileData is the name Uploadify gives the post value containing the file
dim theField
set theField = theForm("FileData")(1)
If theField.FileExists Then
''// Renamed the file adding a "random" string in front of the name
dim FileName
FileName = replace(trim(cdbl(now())), ".", "_") + "_" + theField.FileName
theForm.AbsolutePath = True
theField.Save Server.MapPath("../uploadedfiles") & "/" + FileName
''// Some browser need this
Response.write "<html><head><title>File uploaded</title></head><body>File uploaded</body></html>"
End If
我正在使用uploadify,我已经更改了我的文件名,如下所示,请检查我的OnComplete函数
'onComplete': function (a, b, c, d, e) {
var dt = new Date();
var file = c.name.split('.')[0] + "_" + dt.getUTCDate() + dt.getFullYear() + "." + c.name.split('.')[1];
$("#hdntxtbxFile").val(file);
UploadSuccess(file, "File"); //function call
// }
},
我希望它能对您有所帮助我正在使用uploadify,我已经更改了我的文件名,如下所示,请检查我的OnComplete函数
'onComplete': function (a, b, c, d, e) {
var dt = new Date();
var file = c.name.split('.')[0] + "_" + dt.getUTCDate() + dt.getFullYear() + "." + c.name.split('.')[1];
$("#hdntxtbxFile").val(file);
UploadSuccess(file, "File"); //function call
// }
},
我希望它能帮助你我想你可以在上传文件后在服务器端完成。服务器使用什么语言?我使用ASP,在服务器上我知道如何更改名称。现在的问题是,我如何将新名称发送到Uploadify脚本,我认为您可以在上传文件后在服务器端执行。服务器使用什么语言?我使用ASP,在服务器上我知道如何更改名称。现在的问题是,如何将新名称发送到Uploadify脚本