使用会话变量更改文件名

时间:2018-08-09 04:37:15

标签: javascript c# asp.net

我有下面的代码可以正常工作,但是我想使用不知道如何编辑的session(“ MyFileName”)变量值来更改文件名。

function onUploadClick() {
if (fileUpload.value.length > 0) {
    var filename = fileExists();
    if (filename == '') {
        //Update the message
        updateMessage(MessageStatus.Information, 'Initializing upload ...', '', '0 of 0 Bytes');
        //Submit the form containing the fileupload control
        form.submit();
        //Set transparancy 20% to the frame and upload button
        Sys.UI.DomElement.addCssClass($get('dvUploader'), 'StartUpload');
        //Initialize progressbar
        setProgress(0);
        //Start polling to check on the progress ...
        startProgress();
        intervalID = window.setInterval(function() {
        PageMethods.GetUploadStatus(function(result) {
            if (result) {
                setProgress(result.percentComplete);
                //Upadte the message every 500 milisecond
                updateMessage(MessageStatus.Information, result.message, result.fileName, result.downloadBytes);
                if (result == 100) {
                    //clear the interval
                    window.clearInterval(intervalID);
                    clearTimeout(subintervalID);
                }
            }
        });
        }, 500);
    }
    else
        onComplete(MessageStatus.Error, "File name '<b>" + filename + "'</b> already exists in the list.", '', '0 of 0 Bytes');
}
else
    onComplete(MessageStatus.Warning, 'You need to select a file.', '', '0 of 0 Bytes');
}

如果文件存在,我也需要替换。

0 个答案:

没有答案