.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

asyncFileUpload. how to get new FileName after uploda

Posted By:      Posted Date: October 22, 2010    Points: 0   Category :ASP.Net


I'm using ajax.toolkit asyncFileUpload to do the async image upload.

I don't know how to  get the new file name that i give it in server side.

This js function 

#  function uploadComplete(sender, args) {  
# var contentType = args.get_contentType();
# var text = args.get_length() + " bytes";
# if (contentType.length > 0) {
# text += ", '" + contentType + "'";
# }
# alert(args.get_fileName());
# }

only returns the name of the filename on the client, not the new name that I have given server side
how can I do?



View Complete Post

More Related Resource Links

how to refresh image updated with AsyncFileUpload


I've created an AsyncFileUpload device that uploads an image in ListView but it doesn't refresh on the page until the page is manually refreshed. Any ideas on how to accomplish this? This is the applicable code:

In ListView control:

<asp:UpdatePanel ID="udpPhoto" runat="server">
        <span style="text-align: center; vertical-align: middle; font-size: 7pt;">
            <br />
            <asp:Button ID="btnEPhoto" Font-Bold="False" TabIndex="160" Text="Upload/Change Photo"
                UseSubmitBehavior="False" OnClick="btnPhoto_Click" runat="server" />
            <br />
            <asp:Label ID="lblEPhoto" runat="server" Font-Bold="True" Text="Uploaded Photo:" />
            <br />
            <asp:HyperLink ID="lnkEPhoto" runat="server" BorderWidth="2px" NavigateUrl='<%# Eval("Photo_Recent") %>'
                <asp:Image runat="server" ImageUrl='<%# Eval("Photo_Recent") %>' Height="50px" ID="imgEPhoto">

AsyncFileUpload is not uploading the file



I have added AsyncFileUpload to creata user wizard control. When I tried to upload the file this control seemed to work fine and show confirmation at the end. But when I checked the website no file has been uploaded at all.

Here is the code, please let me know why its not uploading the files/images

<asp:ToolkitScriptManager ID="ScriptManager1" runat="server"></asp:ToolkitScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server"  
 FinishDestinationPageUrl="~/MyPage.aspx"                                     LoginCreatedUser="False" CreateUserButtonText="Add" oncreateduser="CreateUserWizard1_CreatedUser1" 
<asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server" >
<asp:WizardStep ID="WizardStep1" runat="server" Title="Set preferences">
<asp:AsyncFileUpload ID="AsyncFileUpload1" runat="server" ThrobberID="spanUploading" OnClientUploadError="

Ajax Asyncfileupload doesn't work as soon as I put it in a control


Hi guys,

I can't get my <ajax:asyncfileupload> working and I don't see why...

When outside any panel or table it is working well, but as soon as I put it in a <asp:panel> or table I get a strange error which seems to be on client-side but I don't understand what's happen here. Here is the code and code-behind and Javascript.

Here's the error: 


Here's my front-code:

<%@ Page Language="VB" MasterPageFile="~/masterpages/mpSqueletton.master" AutoEventWireup="false" CodeFile="frmAdmGestSocietes.aspx.vb" Inherits="adm_frmAdmGestSocietes" title="Untitled Page" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cphHead" Runat="Server">
<script type="text/javascript" language="javascript">    
        function uploadError(sender,args)
          document.getElementById("<%= lblStatus.ClientID %>").innerText = args.get_fileName(), "<span style='color:red;'>" + args.get_errorMes

AsyncFileUpload: Throw Error on image size


I have an AsyncFilUpload that is used to upload  to my site. On the server side I have code that checks the width and height of the image and will only save the image if it is within the limits buit I can't figure out how to get the AsyncFileUpload control to show an error when this happens. Can anyone give me any pointers?


Asyncfileupload doesn't work in webusercontrol

I'm having a problem with a Webusercontrol that has an asyncfileupload control. My websusercontrol is being loaded in a placeholder control that's wrapped by an updatepanel.Due to asyncpostback, I have to load and clear the placeholder's controls. The webusercontrol works flawlessly, except the asyncfileupload, which doesn't want to upload at all. I can assure that the code is without error, because I used to have the webusercontrol running as an *.aspx site. I guess that the problem is the fact that the control has to be cleared and reloaded with every asyncpostback ?

Are ModalPopupExtender and AsyncFileUpload.OnClientUploadComplete incompatible?

A ModalPopupExtender works fine with a panel as the target control and the panel has an AsyncFileUpload control. However as soon as AsyncFileUpload.OnClientUploadComplete is set to something (e.g. onclientuploadcomplete="alert('hello');"),  the panel is not hidden on page load.Is there any compatibility issue here?


Dear Experts,Is it possible to include asncFileUpload in ajax 1.0 (visual Studio 2005), If yes can you please help me?thanks in advance

filename without directory

how to insert the exact  filename to the database without getting the full directory like c://something/something/filename  into the column 'Filename'     waitng for reply

Capture the xml filename and load in a table

Hey I am having folder which contains multiple xml files.Now I need to read the xml file name and write in a table. I follwed the steps which are in the following link. http://www.sqlservercentral.com/articles/SSIS/67871/ But I am getting data as well as. I need only the file name to be written in a table.

Cannot get Asyncfileupload to fire UploadComplete event... :(

hey everyone!I cannot get the asyncfileupload to fire the uploadcomplete event at all. I did a test:    Protected Sub AsyncFileUpload1_UploadedComplete(ByVal sender As Object, ByVal e As AjaxControlToolkit.AsyncFileUploadEventArgs) Handles AsyncFileUpload1.UploadedComplete         Dim currentUser As MembershipUser = Membership.GetUser()         Dim currentUserId As Guid = CType(currentUser.ProviderUserKey, Guid)         errorLabel.Text = "Test"     End Sub    Protected Sub AsyncFileUpload1_UploadedComplete(ByVal sender As Object, ByVal e As AjaxControlToolkit.AsyncFileUploadEventArgs) Handles AsyncFileUpload1.UploadedComplete       errorLabel.Text = "Test"    End Suband... nothing. The background turns green, my throbber activates successfully.. but then, I get nothing. It doesnt even make it to the uploadedComplete event. I also did the same test in the error event.. and still nothing. Any ideas??

How to clear AsyncFileUpload if page revisited

Hello all,   just downloaded the latest Ajax toolkit and want to use AsyncFileUpload in my project. But the control keeps the path of previously uploaded file if page revisited again (in my case - a popup page). Is there any parameter can be set to clear the path box (it shows previous path in red). You know, the simple something like syncFileUpload.Clear() would of been nice! But it doesnt have it. Any work around? I tried to place it on page Init and set as New but didnt help.   Thanks in advance.   Nat    

user.identity.name="0" when uploading file using ajaxToolkit:AsyncFileUpload

hi, i am using AsyncFileupload to upload user picture. after the picture is uploaded and saved i opened another page and i noticed that the user.identity.name is lost. any idea 

Error: Internet Explorer Cannot Download FileName from WebServer

I am trying to display documents (.Doc / .PDF) through my web page.The code works fine in FireFox, but gives an error message on IE 6.0 / 7.0 / 8.0 Context.Response.Buffer = true;Context.Response.Clear();Context.Response.BufferOutput = false;Context.Response.ContentType = File.GetContentType(File.FileName);Response.AppendHeader("Pragma", "public");Response.AppendHeader("Cache-Control", "max-age=0");Response.Charset = "";Context.Response.AddHeader("content-length", File.FileData.Length.ToString());Context.Response.AddHeader("content-disposition", File.GetContentDisposistion(File.FileName)); Context.Response.BinaryWrite(imageFileBase.FileData);Context.Response.Flush();Context.Response.End();

RegularExpressionValidator and the new AsyncFileUpload

 Hi,I try to valide the new AJAX AsyncFileUpload control but it seems not to work : Control 'AsyncFileUpload1' referenced by the ControlToValidate property of 'REV1' cannot be validated.<cc1:AsyncFileUpload ID="AsyncFileUpload1" runat="server" Width="400px"                     ThrobberID="throbber" />                <asp:Label ID="throbber" Style="display: none" runat="server"><img alt="loading" src="images/upload.gif" /></asp:Label><asp:RegularExpressionValidator                    ID="REV1" runat="server" ErrorMessage=" File invalid"                    ControlToValidate="AsyncFileUpload1" ValidationExpression="(.*\.([gG][iI][fF]|[jJ][pP][gG]|[jJ][pP][eE][gG]|[bB][mM][pP]|[pP][nN][gG])$)"                    Display="Dynamic" Text="

How to show a message box on an invalid filename entered while saving a file using save file dialog

Hi all i have written a code to display a message box if invalid characters are entered while saving the file but my message box is not displaying. Actually i will have a save file dialog option to save a file if the filename starts or consists of the following    \\/:*?<>|"  I would like to display a message box as invalid or illegalcharacters in file My code is as follows    Stream myStream;                          SaveFileDialog saveFileDialog1 = new SaveFileDialog();                            saveFileDialog1.InitialDirectory = @"C:\";                          saveFileDialog1.DefaultExt = "txt";                          saveFileDialog1.Filter = "(*.txt)|*.txt";                          saveFileDialog1.FilterIndex = 2;                          saveFileDialog1.RestoreDirectory = true;                            if (saveFileDialog1.ShowDialog() == DialogR

merging two textfiles along with filename

Hi Team, I wantto build a package which takes input from .txt files and write in abc.txt along wiht the file name so if input is file a.txt content is lksjklsslkjfksf sfjsdkjflsd file b.txt content is lksjklsslkjfksf sfjsdkjflsd  then output abc.txt should be a.txt lksjklsslkjfksf sfjsdkjflsd b.txt lksjklsslkjfksf sfjsdkjflsd   Please give me some suggsetion on how to do it its like inserting file name then data in the same column Regars, Eshwar    

Get filename HttpWebRequest

I'm downloading some files with HTTPRequest, following this tutorial http://www.geekpedia.com/tutorial179_Creating-a-download-manager-in-Csharp.html However, how do I get the filename? I need to get the file name in order to save it, because I don't know the extensions of the files.   PS: I asked this question in the wrong place : http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/f3be4bbb-8025-4b1f-a2dd-b1b70b071bc7 Sorry to ask again here (in the right place)Get a life. Go party!
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend