Showing posts with label upload. Show all posts
Showing posts with label upload. Show all posts

Saturday, March 24, 2012

Upload AjaxControlToolkit.resources.dll in production server

Do I really need to upload all AjaxControlToolkit.resources.dll in my production server?

Thanks!

Only if you want to support the relevant languages. If English is all you need, feel free to omit the satellite DLLs.

Upload control in update panel

How can i use an upload control in an update panel ?

Thanks in advance !

As specifically specified in the ATLASdocumentation the file upload control do not work with update panels asthey alter the page request and the way the data is sent to theserver.

It's a pity as this is one area that could benefit greatly from this kind of functionality..Sad [:(]

Upload control in a Wizard in an Update Panel. How to add the trigger dynamically?

I have an update panel surrounding a Wizard control. One of the steps in that wizard is that the user can upload photos. So what I want to do is add a trigger to force a full postback on the upload step.

Is this at all possible? I'm having troubles obtaining the correct ControlID to add on the trigger...

ctafield:

I have an update panel surrounding a Wizard control. One of the steps in that wizard is that the user can upload photos. So what I want to do is add a trigger to force a full postback on the upload step.

Is this at all possible? I'm having troubles obtaining the correct ControlID to add on the trigger...

Hi.

FileUpload is not supported with ASP.NET AJAX .because that you cann't use it and you cann't find it with ControlID's!


Create a Button Control and set this as a PostBack trigger forupdatePanel. In the Button Click event save the file from File uploadcontrol.

anishdevasia:

Create a Button Control and set this as a PostBack trigger for updatePanel. In the Button Click event save the file from File upload control.

Thank you for the suggestion. I'll give it a go!

Upload control and updatepanel

I've got an upload control in an updatepanel

<ajax:UpdatePanelrunat="server"ID="upCreateExpert">

<

ContentTemplate><asp:FileUploadID="fuCV"runat="server"/>...

But when I access it on the server side I can't get to it. It says it has no file, the HasFile attribute is set to False.

I read up somewhere in the forum that you can put the FileUpload control just before the <ContentTemplate> tag. I'm running AJAX Beta 1 but this is not possible.

Does anyone have any suggestions?

Unfortunately, this control and a few others (TreeView and Menu) are not supported in UpdatePanels.

upload doesnt work inside Update Panel.

I put following code inside an UpdatePanel. The upload control doesn't work.
If I remove the updatepanel, the it is OK.

<input id="fileUpload" type="file" size="60" name="fileUpload" runat="server" />
<asp:Button ID="btnUpload" runat="server" Text="Upload"></asp:Button>You're right, this is a known issue. Do a search.
Hi~ One walk around to this is to put an iframe in update panel and do the upload in the page held in that iframe~

I'm sorry, but has anybody found the solution for this problem?


File uplod is not suposed to work within update pannel.
Solution how to overcome this behavior:
http://msmvps.com/blogs/luisabreu/archive/2006/12/14/uploading-files-without-a-full-postback.aspx

Maybe this helps...

Or add a button beside file upload control with name "Upload file" and add postback trigger to update pannel for that button click event. File will be uploaded when this button is pressed but page then will do normal postback

Mindaugas

UPLOAD FILE WITH ATLAS

I need a sample that allows to upload files using ATLAS.

Thanks in advance!

hello.

can you give more details on what you're after?


Well, I need to upload XML files from a WebBrowser (Internet Explorer, FireFox, etc) to the WebServer using UploadFile control.

How can I do it with ATLAS!?


hello.

unfortunally, by default, you can't do it without writting code to perform this action.


ok! Could you help me with this? Could you send me a sample to perform this action?


hello.

unfortunatelly, i still haven't written anything that let's me perform that kind of action. i'll report abck if i manage to get something working.

Upload image in Tab container

Hi,

I have a tab container which has 3 tabs Picture, profile and Description......

On clicking Picture tab i need to upload an image and display.....

But i am not able to do so......

pls help me....

Hi,

Thank you for your post!

Here is a good article aboutuploading-files-without-a-full-postback:http://msmvps.com/blogs/luisabreu/archive/2006/12/14/uploading-files-without-a-full-postback.aspx

Our good old friend the IFrame used to be the preferred option for asynchronous http communications. Because an iframe is in essence it's own browser window, it can be used to fire off asynchronous requests (both POST and GET). However, even more important is an IFrame's ability to be a 'target' of a form POST. By adding an IFrame to the page and setting it as the target of the form post, you can in essence create an asynchronous file transfer.

When you upload your image to the server,display it like this:

<asp:Image ID="Image2" runat="server" Visible="False" />
Image2.ImageUrl = "the path you saved the image to";

Image2.Visible = true;


For more infoemation, see:

AJAX, file downloads, and IFRAMEs

http://blogs.infragistics.com/blogs/tony_lombardo/archive/2007/04/09/file-uploads-where-s-the-ajax.aspx

If you have further questions,let me know.

Best Regards,

Upload Image Without PostBack in Asp.Net 1.1

I want to upload image without PostBack in Asp.Net 1.1 not 2.0. Is it possible to upload image without postback?

Technically, no. You can isolate the postback by using an IFRAME, however. Just build a page that handles the image uplaod bit (and not hing else), then refer to said page as the src of an IFRAME in whatever page youw ant to have host the 'upload control'.


Do you have any example code? I don't have any idea. I want to upload image without Postback and then the image will be appear in the Image web contorl. I'm using asp.net 2.0.

Thanks,

Upload Progress Bar

So I'm taking a file and loading it into a stream and then displaying that file. I'm wondering if there is a way to add a progress bar that will show how much of the upload has finished. I've googled for something that tells me how to track the completion of the upload into the stream, but couldn't find anything.

Can someone point me in the right direction?

Here's my code:


1FileStream fs =new FileStream(FileUpload1.FileName, FileMode.OpenOrCreate, FileAccess.Read);
2 Byte[] img =new Byte[fs.Length];
34 fs.Read(img, 0, Convert.ToInt32(fs.Length));
56 System.IO.MemoryStream ms =new System.IO.MemoryStream(img);
7//System.IO.Stream ps = new System.IO.MemoryStream(img);
8 //System.Drawing.Bitmap b = (System.Drawing.Bitmap)System.Drawing.Image.FromStream(ms);
9 //System.Drawing.Bitmap b = new System.Drawing.Bitmap(ps);1011 System.Drawing.Bitmap sb = (System.Drawing.Bitmap)System.Drawing.Image.FromStream(FileUpload1.PostedFile.InputStream);
1213 sb.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
On the other hand, what I need is an image upload with a preview and upload progress bar, where the preview is cached/dynamically generated and not stored on the disk. 
Thanks!

Hi,rksprst

Need a preview, you can do it like this:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Default25 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string oIP = Context.Request.QueryString["oIP"];
MakeThumbnail(oIP, oIP + ".JPG", 100, 0, "W");
}
/// <summary>
///
/// </summary>
/// <param name="originalImagePath"></param>
/// <param name="thumbnailPath"></param>
/// <param name="width"></param>
/// <param name="height"></param>
/// <param name="mode"></param>
public void MakeThumbnail(string originalImagePath, string thumbnailPath, int width, int height, string mode)
{
System.Drawing.Image originalImage = System.Drawing.Image.FromFile(originalImagePath);

int towidth = width;
int toheight = height;

int x = 0;
int y = 0;
int ow = originalImage.Width;
int oh = originalImage.Height;

switch (mode)
{
case "HW":
break;
case "W":
toheight = originalImage.Height * width / originalImage.Width;
break;
case "H":
towidth = originalImage.Width * height / originalImage.Height;
break;
case "Cut":
if ((double)originalImage.Width / (double)originalImage.Height > (double)towidth / (double)toheight)
{
oh = originalImage.Height;
ow = originalImage.Height * towidth / toheight;
y = 0;
x = (originalImage.Width - ow) / 2;
}
else
{
ow = originalImage.Width;
oh = originalImage.Width * height / towidth;
x = 0;
y = (originalImage.Height - oh) / 2;
}
break;
default:
break;
}


System.Drawing.Image bitmap = new System.Drawing.Bitmap(towidth, toheight);


System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap);


g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;


g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;


g.Clear(System.Drawing.Color.Transparent);


g.DrawImage(originalImage, new System.Drawing.Rectangle(0, 0, towidth, toheight),
new System.Drawing.Rectangle(x, y, ow, oh),
System.Drawing.GraphicsUnit.Pixel);
try
{
HttpResponse httpResponse = Context.Response;
httpResponse.Clear();
httpResponse.ContentType = "Image/Jpeg";
bitmap.Save(httpResponse.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
httpResponse.End();
}
catch (System.Exception e)
{
throw e;
}
finally
{
originalImage.Dispose();
bitmap.Dispose();
g.Dispose();
}
}
}

Use it like this:

<%@. Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
ImageMap1.ImageUrl = "Default25.aspx?oIP=C:\\Documents and Settings\\v-jyyin\\Desktop\\IMG\\c4960543c39f4f0c71b53bf27aa34e65.jpg";
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server" method="get">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
<asp:ImageMap ID="ImageMap1" runat="server">
</asp:ImageMap></div>
</form>
</body>
</html>

By the way,I don't think you can get the progress bar without ActiveX.

Uploadcontrol asp.net

Hi Friends, Using upload control in asp.net how can we upload .mp3 and power point presentation.Because i want to store that information in MS sqlserver.Can anybody help me to provide c# code thanxkiran

please refer to this MSDN articlehttp://msdn2.microsoft.com/en-us/library/aa478971.aspx

to save your file to a Database refer tohttp://www.codeproject.com/aspnet/fileupload.asp

Uploadfile behind an UpdatePanel

Hello,

After add an UpdatePanel, I don't have value for property filename of my upload control.

is there a workaround ?

thanks for your help

Hello

If you give look atUpdatpanel documentaion you will see note about that:

You cannot place file upload controls inside of UpdatePanel controls, because the data transfer interferes with partial page updates. File upload controls can be on the same page as UpdatePanel controls, but they must be placed on the page outside of UpdatePanel controls.

I hope this help

Uploading a file in a updatepanel

Basically, I am trying to do an upload inside the updatepanel. (Ajax, C#, Visual Studio 2005)

I don't think it's possible to do it without full page post back.. (If I am wrong, please let me know how!!)

So, I decided to put a not-visible button in master.master page. The code follows below.

<%@dotnet.itags.org. Master Language="C#"
AutoEventWireup="true"
CodeFile=" Master.master.cs"
Inherits="Master" %
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<!--General Stylesheet-->
<link rel="stylesheet" href="http://links.10026.com/?link=css/gen_style.css" type="text/css" />
</head
<body style="border:0px; margin:0px;"
<form id="submitTicketForm" method="post" runat="server" enctype="multipart/form-data">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="MainLoginPanel" runat="server">
<ContentTemplate
<!--Top Logo-->
<div class="headerTop">
<div id="header">
<div class="logo"></div>
<div class="login">
<asp:Panel runat="server" ID="LogOutPanel">
<asp:Button OnClick="LogOut_Click" runat="server" ID="LogOut" Text="Click here to logout" Width="142" CssClass="myBtn" />
</asp:Panel>
</div>
</div>
</div
<!--Tab_Panel-->
<asp:Panel runat="server" ID="Tab_Panel">
<div class="tabTop">
...
</div>
</asp:Panel>
<div class="contentplaceholder">
<asp:contentplaceholder id="mainContent" runat="Server"></asp:contentplaceholder>
</div>
<asp:Button id="UploadButton" Visible="false" runat="server" Text="Submit" CssClass="myBtn" OnClick="sendData" />
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="UploadButton" />
</Triggers>
</asp:UpdatePanel
<!--Page Footer-->
<div class="footer">Footer</div>
</form>
</body>
</html
Then the below is the code for NewTicket.aspx. If I press the btn_sendData button, I need to trigger the UploadButton button in the master's page.

<%@dotnet.itags.org. Page Language="C#"
MasterPageFile="~/Master.master"
AutoEventWireup="true"
CodeFile="NewTicket.aspx.cs"
Inherits="NewTicket"
Title="SPN Ticketing System - Submit a New Ticket" %
<%@dotnet.itags.org. Register Assembly="AjaxControlToolkit"
Namespace="AjaxControlToolkit"
TagPrefix="ajaxToolkit" %
<asp:Content ID="Content1" ContentPlaceHolderID="mainContent" Runat="Server">
<asp:FileUpload ID="fileChoose" runat="server" />
<asp:Button id="btn_sendData" runat="server" Text="Submit" CssClass="myBtn" OnClick="TriggerMasterUploadBtn" />
</asp:Content
Now, the below is the partial code from NewTicket.aspx.cs.

protected void TriggerMasterUploadBtn(object sender, EventArgs e)
{

Control btnControl = Page.Master.FindControl ( "UploadButton" );
Button btn = (Button)btnControl;
//I have the control but I don't know what to do!
}

I've been pulling my hair for hours for this thing.
Your help is GREATELY appreciated!
Thank you again.

It is not possible to do a file upload without doing a full post back. If you have the fileupload inside the update panel you will need to add a trigger to the button that will take care of the uploading. There have been many posts on this forum about this, and some have some good work arounds.

http://forums.asp.net/thread/1444713.aspx

There is alink on one of the threads that is to an MSDN page that listed all the controls that currently do not work with update panel but I can't seem to find it. If anyone does, please post it here.

Uploading file during onchange

I try to upload file in server during user select file:

<inputid="iupload"runat="server" type="file"style="width:1px"/>
<inputtype="hidden"id="hdName"runat="server"/>

<scriptlanguage="javascript">
function Doo(){
document.getElementById('hdName').value = document.getElementById('iupload').value;// to check path
WebForm_DoCallback('__Page',document.getElementById('iupload').value,CallbackFunction,'context',null,false);returnfalse;
}
</script>

and on server side:

protectedvoid Page_Load(object sender, EventArgs e)
{
string argClientFunction ="";
string cScript = ClientScript.GetCallbackEventReference(this, argClientFunction,"CallbackFunction","'context'","null",false);
string f=@dotnet.itags.org."
javascript:Doo();";
iupload.Attributes.Add("onchange", f);

string scr ="<script language=javascript>";
scr +="function CallbackFunction(result, context)";
scr +="{";
scr +="document.getElementById('spUploaded').innerText += 'Done';";
scr +=" return false;";
scr +="}";
scr +="</script>";
RegisterStartupScript("scr" +this.ClientID, scr);

}


publicvoid UploadFile(string fileName)
{
// try to upload file to server
}
publicstring GetCallbackResult()
{
UploadFile(evArg);

evArg = String.Empty;

return evArg;
}
publicvoid RaiseCallbackEvent(string eventArgument)
{
evArg = eventArgument;
}

Problem occur in UploadFile(...): When I try to get iupload.PostedFile for file uploading it's null. I can get file name only.

How can I upload file normally without postback with onchange ?

I need upload file to server as Gmail or Yahoo Mail!

File uploads require a full postback. There has been a lot of talk on here about sites such as gmail that appear to asynchronously load a file. At this point, the only way that I have heard of this successfully implemented is by using IFrames and have another page that does the full postback, but doesn't look like it.


Thank you! I have heard about Iftame to upload files. Have you any information about this?


Not really... we haven't got into handling file uploads very often, and if we do, we would probably use the telerik fileupload control since we have the suite and I believe it handles very large files much better that the built in fileupload for asp.net. When I tested both of them, I was able to crash IIS with the built in control by trying to upload a dvd image because it seemed to check for the file size only after it had been processed through IIS, but the telerik control seemed to do that in pieces which didn't cause it to lock up.

Uploading File doesnt work when using UpdatePanel!

Hi,

Uploading files works fine but when i tried to include everything inside the UpdatePanel then i can no longer upload. The reason is that on my PostBack, the input values(file1, file2, file3, file4) have empty values..

<tableborder="0"cellspacing="0"cellpadding="0"style="border-collapse: collapse;">

<trid="fileInput1"><tdalign="left"class="VerdanaXXSmallBlue">1) </td>

<td><inputid="file1"type="file"runat="server"class="VerdanaXSmallBlue"style="width: 100%"/></td></tr><trid="fileInput2">

<tdalign="left"class="VerdanaXXSmallBlue">2) </td>

<td><inputid="file2"type="file"runat="server"class="VerdanaXSmallBlue"style="width: 100%"/></td></tr><trid="fileInput3"><tdalign="left"class="VerdanaXXSmallBlue">3) </td><td><inputid="file3"type="file"runat="server"class="VerdanaXSmallBlue"style="width: 100%"/></td></tr><trid="fileInput4"><tdalign="left"class="VerdanaXXSmallBlue">

4)

</td><td><inputid="file4"type="file"style="width: 464px"class="VerdanaXSmallBlue"runat="server"/></td></tr></table>

Hi Kiril,

The Ajaxdocumentation states that theFileUpload control is not compatible with partial-page updates and is therefore not supported inside an UpdatePanel. To use aFileUpload control inside anUpdatePanel control, set the postback control that submits the file to be aPostBackTrigger for the panel.

HTH


cool. thanks

Uploading files

I am using ajax 1.0, when i am uploading files, it does not working properly, it is not uploading any images. I heared that file upload will not work in ajax, is it true? help appreciated

Hi sreejithpkrishnan,

I don't know if you want to uploadfiles in combination wioth an update panel if so check the summary below:

Controls that are not compatible with updatepanel controls

The following ASP.NET controls are not compatible with partial-page updates, and are therefore not supported inside anUpdatePanel control:

TreeView andMenu controls.


Hi,

the FileUpload, and several other controls, don't play nicely together with the UpdatePanel control. You can however use inside it but must set it to be a PostBackTrigger for the UpdatePanel. Read more about ithere andhere. The last link provides a sample for the FileUpload control that works together with the UpdatePanel control.

Grz, Kris.


hello.

In the past, I've written an extender which lets you upload files without performing a postback. it was written for the beta 2 or rc version (really can't recall it), but you should be able to update it to the current release without having much problems.

http://msmvps.com/blogs/luisabreu/archive/2006/12/14/uploading-files-without-a-full-postback.aspx