Web Forms :: Show Image After Upload
Jul 5, 2012
I have 2fileupload control 2 button and 2 <asp:image>
I want when user select their image from FUP and click on button it show their selected image into image tag so i should bind image tag from database but i don't know where should i write code that bind my image tag from database
These are my code
protected void BtnUpload_Click(object sender, EventArgs e)
{
string path = Server.MapPath(".") + "../image/House";
string filename = System.IO.Path.GetFileName(fup1.PostedFile.FileName);
fup1.PostedFile.SaveAs(path + filename);
[Code] ....
And second button ....
protected void BtnUpload2_Click(object sender, EventArgs e)
{
fup2.PostedFile.SaveAs(path + filename);
SqlCommand _cmd = new SqlCommand("Fileup3", _cn);
_cmd.CommandType = CommandType.StoredProcedure;
[Code] ....
View 1 Replies
Similar Messages:
Mar 14, 2010
i am using Asynchronous file upload in model pop up control . i want to show the uploaded image's preview wthin the modelpopup after the upload is completed. anyone tell me how i can do it
View 4 Replies
Jan 18, 2011
I have been cracking at this for a while now with no luck.
Using asyncfileupload control to upload a file and display the image. The uploading works fine and image is displayed if I reload/refresh the page.
But need to know how I can do this without reloading/refreshing the page.
After reading online posts, I see a recommendation to use scriptmanager but this doesn't work for me:
protected void FileUploadComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
{
ScriptManager.RegisterStartupScript(this, GetType(), "TestAlert",
"window.parent.document.getElementById('" + img_ProfilePic.ClientID + "').src='" + "http://www.site.com/default.jpg" + "');",
true);
}
View 3 Replies
Mar 4, 2010
i have a image control that show Captcha...
Problem:in the Host(not local system) Captcha show only one image that created for first time,but in my local system every things is right,and captcha change for every page load...
i think image can't find server folder address and always show first produced image!!!
see code:
[Code]....
where is the problem?
notice:when i see server "Upload" folder and "AddIntuitionReflexRandom.gif" file,content change truly,but that can't show in my image.
View 10 Replies
Dec 28, 2010
How can I save image in db as byte array and show the saved image as slide show in my web page with C# asp.net 3.5
View 1 Replies
Apr 16, 2013
I have filed image type varbinary
I want upload image and show then with click button save
store in db
View 1 Replies
Oct 18, 2013
How to upload images with some conditions
Like
size not gretr than 50 kb
with = 110px, height 140 px
etc..
View 1 Replies
Jan 22, 2011
i'm a new in web page application
can any one tll me how to upload in image in the web page and dispay it in an image control then save the path to the database?
View 2 Replies
Feb 2, 2011
I'm having an image in my page displayed to clients form a folder under same apllication folder,I also have a form in the same page that accepts an image file to be uploaded. The image that is uploaded via this form should take the place of the image that's displayed in the page with the name newly givven at runtime. The new image should be uploaded in the same directory with the new name provided, which means it overwrites the previous image.
View 5 Replies
May 9, 2010
iam using asp.net with c#
i want to display image in a image control as soon as we browse with file upload control ,i dont want to use button click event
[Code]....
View 1 Replies
Jun 19, 2012
[URL].... I got correct code .. but image is not stable on mouse over.... little bit flying...
and on mouse out still previous image will display.....
Requirement:
I have grid with some product details.. like product id ,price,description. on mouse over of each row. should display a image of particular product thumb nail..
View 1 Replies
Jun 1, 2010
I'm no expert with Image controls, or dynamically adding anything, but I seem to have some problem when dynamically adding image controls
When the page loads the images are "there", but they don't actually show an image...just an image "box" I guess you could call it. It's not the "broken" image or "invalid" image display, but a friendlier one that doesn't make sense to me why it's there.
I look at the page's source and literally everything's fine, but I'm not sure what's going wrong. I can show you my code, and hopefully someone will point out the dumb thing I'm doing wrong:
[Code]....
[Code]....
So, it takes all the .JPG files in the folder "Pictures" of my project's folder and creates an Image control to be put into Panel1 with the ImageURL as its filename (with Directory Path) and even set the ID to its filename (so no duplicate IDs). Again, the source is exactly how it should be, but no image is shown.
View 7 Replies
Jun 19, 2010
Me with C# asp.net. In my sqlserver database table I have 2 fields Id and Imagepath like
Id Imagepath
1 images/car1.jpg
1 images/car2.jpg
1 images/car3.jpg
2 images/car4.jpg
2 images/car5.jpg
On page1.aspx I have a text box and a button, on entering 1 in textbox and on button click load, I want to show page2.aspx and all the images with Id 1 (ie car1.jpg,car2.jpg,car3.jpg) should be shown. How can I show like this with out placing image control by default in page2.aspx because number of image varies ie if I enter 2 I want to show only 2 images.
View 4 Replies
Apr 8, 2010
I have a menu control that I'm binding with database data, and I want to use a Popout image for submenus, but the image won't show up. I've tried using the default image and using a custom image and neither of them shows up. I've also tried turning it on through code and that doesn't seem to work either. Also, for certain menu items, I would like to show a padlock indicating that security is implemented for this link, but I can't seem to get that to work either. I've tried something like this:
mnuChildItem.PopOutImageUrl = "../images/Icons/menu_out.gif"
View 2 Replies
May 9, 2013
I have to insert default image into databse..when no image is selected from fileupload control.. Here is code...not working for default image...
if (FileUpload1.HasFile){string FileName = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName);
FileUpload1.SaveAs(Server.MapPath("~/UPLOADEDFILES/" + FileName));
feedBack.Attachments.Add(new Attachment(FileUpload1.PostedFile.InputStream, FileName));
} else {
string filename="~/images/"+ "sun.gif";filename.pPropertyImage = filename;FileUpload1.SaveAs(MapPath(filename));}
View 1 Replies
Apr 10, 2010
We have a scenario where we would like to allow our users to upload images to the site. We are running on ASP.Net. A quick search did not result in anything good. It would be great if the control is free/open source but we do not mind paying a little bit.
View 1 Replies
Dec 6, 2010
I'm using a slightly modified version of Valum's upload [github link], I've modified it to upload to a database but haven't modified the javascript that it is using to get the file into the Request as an InputStream. The following line of code is failing in IE 8 but is confirmed to work in Chrome. using (Image imgInput = Image.FromStream(Request.InputStream)) The error received is "Parameter not valid". It appears to be having an issue with the Input Stream being used but it exists/has data (not sure how to validate if the data is good or not).
Page
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Upload-Pictures</h2>
<div id="file-uploader">
<noscript>
<p>Please enable JavaScript to use file uploader.</p>
</noscript>
</div>
<script src="/Scripts/fileuploader.js" type="text/javascript"></script>
<script type="text/javascript">
function createUploader() {
var uploader = new qq.FileUploader({
element: document.getElementById('file-uploader'),
action: '/Admin/FileUpload/' + <%= Model.PropertyId %>,
debug: true
});
}
window.onload = createUploader;
</script>
</asp:Content>
Controller
[AcceptVerbs(HttpVerbs.Post)]
public JsonResult FileUpload(int id)
{
try
{
byte[] newImageByteArray = GetByteArrayForResizedImage(350, Request.InputStream);
byte[] thumbnailByteArray = GetByteArrayForResizedImage(150, Request.InputStream);
//Add to DB
}
catch (Exception ex)
{
// This is where the exception is caught
return Json(new { success = false, message = ex.Message }, "application/json");
}
return Json(new { success = true }, "application/json");
}
private static byte[] GetByteArrayForResizedImage(int imageSize, Stream inputStream)
{
byte[] imageByteArray;
// For some reason in IE the inputStream here is causing it to crash
using (Image imgInput = Image.FromStream(inputStream))
{
//Image processing
}
return imageByteArray;
}
fileuploader.js - qq.FileUploader
/**
* Class that creates upload widget with drag-and-drop and file list
* @inherits qq.FileUploaderBasic
*/
qq.FileUploader = function(o){
// call parent constructor
qq.FileUploaderBasic.apply(this, arguments);
// additional options
qq.extend(this._options, {
element: null,
// if set, will be used instead of qq-upload-list in template
listElement: null,
template: '<div class="qq-uploader">' +
'<div class="qq-upload-drop-area"><span>Drop files here to upload</span></div>' +
'<div class="qq-upload-button">Upload a file</div>' +
'<ul class="qq-upload-list"></ul>' +
'</div>',
// template for one item in file list
fileTemplate: '<li>' +
'<span class="qq-upload-file"></span>' +
'<span class="qq-upload-spinner"></span>' +
'<span class="qq-upload-size"></span>' +
'<a class="qq-upload-cancel" href="#">Cancel</a>' +
'<span class="qq-upload-failed-text">Failed</span>' +
'</li>',
classes: {
// used to get elements from templates
button: 'qq-upload-button',
drop: 'qq-upload-drop-area',
dropActive: 'qq-upload-drop-area-active',
list: 'qq-upload-list',
file: 'qq-upload-file',
spinner: 'qq-upload-spinner',
size: 'qq-upload-size',
cancel: 'qq-upload-cancel',
// added to list item when upload completes
// used in css to hide progress spinner
success: 'qq-upload-success',
fail: 'qq-upload-fail'
}
});
// overwrite options with user supplied
qq.extend(this._options, o);
this._element = this._options.element;
this._element.innerHTML = this._options.template;
this._listElement = this._options.listElement || this._find(this._element, 'list');
this._classes = this._options.classes;
this._button = this._createUploadButton(this._find(this._element, 'button'));
this._bindCancelEvent();
this._setupDragDrop();
};
fileuploader.js - qq.FileUploaderBasic
/**
* Creates upload button, validates upload, but doesn't create file list or dd.
*/
qq.FileUploaderBasic = function(o){
this._options = {
// set to true to see the server response
debug: false,
action: '/server/upload',
params: {},
button: null,
multiple: true,
maxConnections: 3,
// validation
allowedExtensions: [],
sizeLimit: 0,
minSizeLimit: 0,
// events
// return false to cancel submit
onSubmit: function(id, fileName){},
onProgress: function(id, fileName, loaded, total){},
onComplete: function(id, fileName, responseJSON){},
onCancel: function(id, fileName){},
// messages
messages: {
typeError: "{file} has invalid extension. Only {extensions} are allowed.",
sizeError: "{file} is too large, maximum file size is {sizeLimit}.",
minSizeError: "{file} is too small, minimum file size is {minSizeLimit}.",
emptyError: "{file} is empty, please select files again without it.",
onLeave: "The files are being uploaded, if you leave now the upload will be cancelled."
},
showMessage: function(message){
alert(message);
}
};
qq.extend(this._options, o);
// number of files being uploaded
this._filesInProgress = 0;
this._handler = this._createUploadHandler();
if (this._options.button){
this._button = this._createUploadButton(this._options.button);
}
this._preventLeaveInProgress();
};
View 1 Replies
Dec 26, 2010
C# - how to upload and show videos
[Code]...
View 2 Replies
Jan 15, 2014
I want to upload image through fileupload toolbox and display it in image control.
The image control should get the path from fileupload and should display the image.
I have done it with following code attached
HTML Markup-
<asp:FileUpload ID="FileUpload1" runat="server"
style="top: 256px; left: 533px; position: absolute; height: 23px; width: 217px" ForeColor="White" />
<asp:Button ID="btnset" runat="server" Font-Bold="False" Font-Names="Times New Roman" Font-Size="Medium" style="top: 309px; left: 605px; position: absolute; height: 26px; width: 81px" Text="Set Photo " />
<asp:Image ID="Image2" runat="server" style="top: 66px; left: 568px; position: absolute; height: 152px; width: 136px" BorderColor="#CCCCFF" BorderStyle="Ridge" />
VB Code-
Protected Sub btnset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnset.Click
Image2.ImageUrl = FileUpload1.FileName
End Sub
View 1 Replies
Jul 6, 2010
I'm trying to do something simple but all the solutions I have read on the net do not work. I have restricted the file size limit to my uploads to 10MB in the web.config file. Now I want to show an error once a user attempts to submit a file larger than 10MB.All I get is a page cannot be displayed if the file size is too big. I have tried the following:
[code]...
View 7 Replies
Dec 28, 2010
How can upload a image in asp.net.I want a coding
View 3 Replies
Aug 12, 2010
I get the complete Code about how can I uploading an image and view this image at the same page in website
View 3 Replies
Jun 30, 2010
I am trying to make images upload under my userimages folder and create a new folder with the userid. So far my code is:
[Code]....
View 11 Replies
Aug 26, 2010
Uploading pictures I want to change the name at a timeExamples:manchester.jpg ı want to manchester001.jpg ,second image manchester002.jpg...
View 4 Replies
Jun 11, 2010
Is is possible to upload and store image with the same name if it possible then How to uplaod image with same name in a folder... in asp.net.....
View 6 Replies