 |
|
 |
Message Automatically Removed
|
|
|
|
 |
|
 |
arvinder_aneja wrote: if u r uploading the same image again and again dat wud be worst, wen u wud have duplicate images nd dat wud make d application heavy is well..
It seems to me that you are an utter moron. You are using a computer, not a mobile phone. When I say 'don't speak like a retard', and I talking about non words like dat, wud, wen, etc.
In addition, you have been told over and over in the quick answers forum to mark your questions as ASP.NET and you do not. Perhaps you are just too stupid for software development ?
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
 |
|
 |
Message Automatically Removed
|
|
|
|
 |
|
 |
arvinder_aneja wrote: yes i am not perfect for software devolpment yet.. but i know how to talk politely with others as long as they are nice wid me.. but stupid people like you should be learnt a lesson..
i think u got an ugly mind like ur face...
so jus try to speak politely with others.. or peeps will kick ur dumb ass...
so MR christian Graus in short DUMB ASS... i do nt want to waste my time bcuz i have many things to learn.. and i will try hard no matter how many idiots like you wud come in ma way.. so fukkkkkkkk offffffff.
I see - you actually cannot spell at all. I thought it was just txt speak. I apologise. Perhaps you should learn English, so you can deal with your Rentacoder clients.
You think some one votes on my articles is a 'lesson' to me ? I don't care at all. I put them out there, and those articles made me more money than you and your family will see in a lifetime. Their job is done. Your one votes actually made me laugh my head off. You are an incompetent fool who hopes to write code, and you're attacking the people who try to help you. That's brilliant. You're a smart guy.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
 |
|
 |
Haha, thanks for quoting what was bound to be an automatically removed post; I've had my good laugh for the day.
Christian Graus wrote: those articles made me more money than you and your family will see in a lifetime
Out of curiousity, did you directly earn money by writing your articles, or do you mean that they looked nice on the resume and so indirectly got you more money by getting you better paying jobs?
|
|
|
|
 |
|
 |
You would do well to try a little harder not to be a complete penile gland on this site, especially to the guy with the highest reputation (by a wide margin). He got that reputation by helping people with their questions. If he gives you advice regarding your messages, you can pretty much bet that it's going to be good advice.
I recommend that you go back and honestly re-vote those articles. Otherwise, your votes will be deleted, thus making your little rebellion about as effectual as a kickstand on a Sherman tank.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
 |
|
 |
Error 1 'System.Web.UI.HtmlControls.HtmlImage' does not contain a definition for 'ImageUrl' and no extension method 'ImageUrl' accepting a first argument of type 'System.Web.UI.HtmlControls.HtmlImage' could be found (are you missing a using directive or an assembly reference?) C:\Users\cmmaung\Desktop\ExamTest\Test 2\WebApplication1\WebApplication1\Default.aspx.cs 107 32 WebApplication1
|
|
|
|
 |
|
 |
<%@ Page language="c#" Codebehind="upload.aspx.cs" AutoEventWireup="false" Inherits="netimageupload.WebForm1" %>
Inherits="netimageupload.WebForm1"
shows an error ...... "Could not load type 'WebForm1'"
|
|
|
|
 |
|
 |
im getting an error like this 'imgPicture' does not contain a definition for 'ImageUrl' in the line imgPicture.ImageUrl = sSavePath + sThumbFile; plz help
|
|
|
|
 |
|
 |
sSavePath = "images/";
to
sSavePath = "";
over all-ly Good effort
|
|
|
|
 |
|
 |
I have converted the code to vb it works good for me even though it is a strict conversion if anyone else needed it in vb here it is
Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnUpload.Click '// Initialize variables
Dim sSavePath As String 'string sSavePath; Dim sThumbExtension As String 'string sThumbExtension; Dim intThumbWidth As Integer 'int intThumbWidth; Dim intThumbHeight As Integer 'int intThumbHeight;
' // Set constant values
sSavePath = "images/" '; sThumbExtension = "_thumb" '; intThumbWidth = 160 '; intThumbHeight = 120 ';
'// If file field isn�t empty
If (Not filUpload.PostedFile Is Nothing) Then '{ '// Check file size (mustn�t be 0)
Dim myFile As HttpPostedFile myFile = filUpload.PostedFile '; Dim nFileLen As Integer = myFile.ContentLength 'int nFileLen = myFile.ContentLength; If nFileLen = 0 Then '{ lblOutput.Text = "No file was uploaded." '; Return '; End If '}
'// Check file extension (must be JPG)
If (Not System.IO.Path.GetExtension(myFile.FileName).ToLower() = ".jpg") Then '{ lblOutput.Text = "The file must have an extension of JPG" '; Return '; End If '}
'// Read file into a data stream
Dim myData() As Byte = New Byte(nFileLen) {} 'byte[] myData = new Byte[nFileLen]; myFile.InputStream.Read(myData, 0, nFileLen) ';
' // Make sure a duplicate file doesn�t exist. If it does, keep on appending an
'// incremental numeric until it is unique
Dim sFilename As String = System.IO.Path.GetFileName(myFile.FileName) 'string sFilename = System.IO.Path.GetFileName(myFile.FileName); Dim file_append As Integer = 0 ' int file_append = 0; While (System.IO.File.Exists(Server.MapPath(sSavePath + sFilename))) '{ file_append += 1 '; sFilename = System.IO.Path.GetFileNameWithoutExtension(myFile.FileName) & file_append.ToString() & ".jpg" '; ' } End While
'// Save the stream to disk Dim newFile As System.IO.FileStream
newFile = New System.IO.FileStream(Server.MapPath(sSavePath + sFilename), System.IO.FileMode.Create) '; newFile.Write(myData, 0, myData.Length) '; newFile.Close() ';
'// Check whether the file is really a JPEG by opening it
Dim myCallBack As System.Drawing.Image.GetThumbnailImageAbort 'System.Drawing.Image.GetThumbnailImageAbort myCallBack =
myCallBack = New System.Drawing.Image.GetThumbnailImageAbort(AddressOf ThumbnailCallback) '; Dim myBitmap As Drawing.Bitmap ' Bitmap myBitmap; Try '{ myBitmap = New Drawing.Bitmap(Server.MapPath(sSavePath + sFilename)) ';
'// If jpg file is a jpeg, create a thumbnail filename that is unique.
file_append = 0 '; Dim sThumbFile As String = System.IO.Path.GetFileNameWithoutExtension(myFile.FileName) & sThumbExtension & ".jpg" ' ; 'string sThumbFile = System.IO.Path.GetFileNameWithoutExtension(myFile.FileName) '+ sThumbExtension + ".jpg"; While (System.IO.File.Exists(Server.MapPath(sSavePath + sThumbFile))) '{ file_append += 1 '; sThumbFile = System.IO.Path.GetFileNameWithoutExtension(myFile.FileName) & file_append.ToString() & sThumbExtension & ".jpg" '; End While '}
'// Save thumbnail and output it onto the webpage
Dim myThumbnail As System.Drawing.Image myThumbnail = myBitmap.GetThumbnailImage(intThumbWidth, intThumbHeight, myCallBack, IntPtr.Zero) '; myThumbnail.Save(Server.MapPath(sSavePath + sThumbFile)) '; imgPicture.ImageUrl = sSavePath + sThumbFile ';
'// Displaying success information
lblOutput.Text = "File uploaded successfully!" ';
'// Destroy objects
myThumbnail.Dispose() '; myBitmap.Dispose() '; '} Catch errArgument As ArgumentException '{ ' // The file wasn't a valid jpg file
lblOutput.Text = "The file wasn't a valid jpg file." '; System.IO.File.Delete(Server.MapPath(sSavePath + sFilename)) '; End Try '} End If'} '}
End Sub
Public Function ThumbnailCallback() As Boolean '{ Return False '; '} End Function
|
|
|
|
 |
|
 |
Thanks bcalvin. Saved me a lot of faffing about did that.
|
|
|
|
 |
|
 |
plzzz giv me the vb code for this email : shivam.iips@gmail.com 
|
|
|
|
 |
|
 |
Its giving following error.............
"The type or namespace name 'Bitmap' could not be found (are you missing a using directive or an assembly reference?)"
Any help.....Thanks in advance........
|
|
|
|
 |
|
 |
Ok i'm a total amateur so feel free to optimise my fix. I had the same problem, however i added:
using System.Drawing; to the very top.
I also had a problem with the method call (i think thats what you call it.) It is supposed to be:
private void btnUpload_Click(object sender, EventArgs e)
I found that only:
protected void btnUpload_Click(object sender, EventArgs e) works.
all fixed. :D
|
|
|
|
 |
|
 |
Hello sir,
I am having a problem, that to store more than one images to one field in database... i am having a table FingerImage in database(oracle) and i have to store upto 10 finger images to the table but in only one field.
table - FingerImage fields - Id, RealImage
in that RealImage field i have to store all the 10 finger images...
how to perform this using C# alone. this is a window application...
thanks in advance anand 
|
|
|
|
 |
|
 |
This is a great article , it helped a lot! Thanks!
|
|
|
|
 |
|
 |
You save my ass 
You are a great web developer.
dCakmak...
|
|
|
|
 |
|
 |
thanks for the wonderful code, i loaded and ran it on visual studio .net 2003, i'm able to upload the jpegs but after that it doesnt display, any idea what's wrong?
|
|
|
|
 |
|
 |
go and go!!!
????,??????
|
|
|
|
 |
|
 |
// If file field isn’t empty if (filUpload.PostedFile != null) { // Check file size (mustn’t be 0) HttpPostedFile myFile = filUpload.PostedFile; int nFileLen = myFile.ContentLength; if (nFileLen == 0) { lblOutput.Text = "There wasn't any file uploaded."; return; }
// Read file into a data stream byte[] myData = new Byte[nFileLen]; myFile.InputStream.Read(myData,0,nFileLen); Bitmap b = new Bitmap(new MemoryStream(myData));
}
you might consider adding a try and catch on the new bitmap block ..
|
|
|
|
 |
|
 |
Its a fantastic example of uploading image files but i m unable to upload file with size greater than 100 kb when i deploy the application and access it through internet locally it works fine !
waiting for Reply ! Thankx in advance..
|
|
|
|
 |
|
 |
I found it very useful. Thanks.
Words fade as the meanings change, but somehow, it don't bother me.
|
|
|
|
 |
|
 |
in your code you have
"if (filUpload.PostedFile != null)"
This is straight from MSDN library:
Before calling the SaveAs method to save the file to the server, use the HasFile property to verify that the FileUpload control contains a file. If the HasFile returns true, call the SaveAs method. If it returns false, display a message to the user indicating that the control does not contain a file. Do not check the PostedFile property to determine whether a file to upload exists, because this property contains 0 bytes by default. As a result, even when the FileUpload control is blank, the PostedFile property returns a non-null value.
I bolded the important part.
thanks
|
|
|
|
 |
|
 |
hey i love the code
just wondering is there any way to keep the aspect ratio, by asy only declaring the height and leaving the width auto? just for when you insert portrate pictures for example
cheers
Jez
|
|
|
|
 |