views:

1400

answers:

5

Hi there

I'm using uploadify with asp and I want to change the file name to the current date+time when the file is complete.

Is there any way to do it?

this is my JS code:

$('#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)
}

Please advice

A: 

I too am looking for a solution to this problem. (Using .NET WebForms) Any help would be appreciated!

SunScar
I have the solution in asp classic.at the script file, clean the file so the response will be only the new name of the file.at the JS file, print the response method onComplete and you will get the only line that the browser see at the script file.
Chaofix
A: 

I'm using uploadify to upload directly from the browser to S3. I'd love to find out there's a way to tell S3 to name the incoming file something other than the name on the user's local computer.

michaellehmkuhl
A: 

You may want to look into ScriptManager.RegisterClientScriptBlock()

Place it on the codebehind, and calls the function after you rename the file on the server. This call client-side JavaScript (javascriptFunctionName) that will deliver the new filename to Uploadify. Here's some C#:

    public void YourFunction(string fileName)
    {
      ScriptManager.RegisterClientScriptBlock(
        ctrlName,
        ctrlName.GetType(),
        "scriptkey",
        @"javascriptFunctionName('" + fileName + @"');",
        true);
    }    

Hope this helps some. This is used in conjunction with AJAX when you're using ScriptManager, and will notify your Javascript function once the codebehind finishes processing.

Dan
A: 

Anyone care to share their server side code for uploadify with classic asp? Any help is hugely appreciated!

JimJazz