Click here to Skip to main content
15,922,427 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Displaying binary data other than images [modified] Pin
ASPnoob29-Jul-07 23:54
ASPnoob29-Jul-07 23:54 
GeneralRe: Displaying binary data other than images Pin
Christian Graus30-Jul-07 1:09
protectorChristian Graus30-Jul-07 1:09 
QuestionCalling DataLayer From Presentation Layer Pin
N a v a n e e t h29-Jul-07 22:54
N a v a n e e t h29-Jul-07 22:54 
AnswerRe: Calling DataLayer From Presentation Layer Pin
Christian Graus29-Jul-07 23:05
protectorChristian Graus29-Jul-07 23:05 
GeneralRe: Calling DataLayer From Presentation Layer Pin
N a v a n e e t h29-Jul-07 23:31
N a v a n e e t h29-Jul-07 23:31 
GeneralRe: Calling DataLayer From Presentation Layer Pin
Christian Graus30-Jul-07 1:11
protectorChristian Graus30-Jul-07 1:11 
AnswerRe: Calling DataLayer From Presentation Layer Pin
BasharatAli29-Jul-07 23:09
BasharatAli29-Jul-07 23:09 
Questionpreview a picture from my hard disk before upload it Pin
ayeleteric29-Jul-07 22:49
ayeleteric29-Jul-07 22:49 
Hello,

I am trying to preview a picture from my hard disk before upload it to the server but I didn't success, no error occured but no picture is shown.
Please help here is the code

Thank you.






// width to resize large images to
var maxWidth=100;
// height to resize large images to
var maxHeight=100;
// valid file types
var fileTypes=["bmp","gif","png","jpg","jpeg"];
// the id of the preview image tag
var outImage="previewField";
// what to display when the image is not valid
var defaultPic="box_icons.jpg";


function preview(what)
{
var source=what.value;
var ext=source.substring(source.lastIndexOf(".")+1,source.length).toLowerCase();
for (var i=0; i<fileTypes.length; i++) if (fileTypes[i]==ext) break;
globalPic=new Image();
if (i<fileTypes.length)
globalPic.src=source;
else
{
globalPic.src=defaultPic;
alert("THAT IS NOT A VALID IMAGE\nPlease load an image with an extention of one of the following:\n\n"+fileTypes.join(", "));
}

setTimeout("applyChanges()",200);

}

var globalPic;

function applyChanges()

{

var field=document.getElementById(outImage);

var x=parseInt(globalPic.width);

var y=parseInt(globalPic.height);

if (x>maxWidth)

{

y*=maxWidth/x;

x=maxWidth;

}



if (y>maxHeight)

{

x*=maxHeight/y;

y=maxHeight;

}



field.style.display=(x<1 || y<1)?"none":"";

field.src=globalPic.src;

field.width=x;

field.height=y;

}

// End -->









Test it by locating a valid file on your hard drive:









 







Eric H.

AnswerRe: preview a picture from my hard disk before upload it Pin
N a v a n e e t h29-Jul-07 23:03
N a v a n e e t h29-Jul-07 23:03 
GeneralRe: preview a picture from my hard disk before upload it [modified] Pin
ayeleteric29-Jul-07 23:06
ayeleteric29-Jul-07 23:06 
GeneralRe: preview a picture from my hard disk before upload it Pin
N a v a n e e t h29-Jul-07 23:55
N a v a n e e t h29-Jul-07 23:55 
GeneralRe: preview a picture from my hard disk before upload it Pin
ayeleteric30-Jul-07 0:05
ayeleteric30-Jul-07 0:05 
AnswerRe: preview a picture from my hard disk before upload it Pin
enjoycrack29-Jul-07 23:56
enjoycrack29-Jul-07 23:56 
GeneralRe: preview a picture from my hard disk before upload it Pin
ayeleteric30-Jul-07 0:06
ayeleteric30-Jul-07 0:06 
GeneralRe: preview a picture from my hard disk before upload it Pin
enjoycrack30-Jul-07 0:09
enjoycrack30-Jul-07 0:09 
GeneralRe: preview a picture from my hard disk before upload it Pin
ayeleteric30-Jul-07 0:18
ayeleteric30-Jul-07 0:18 
GeneralRe: preview a picture from my hard disk before upload it Pin
enjoycrack30-Jul-07 0:21
enjoycrack30-Jul-07 0:21 
GeneralRe: preview a picture from my hard disk before upload it Pin
enjoycrack30-Jul-07 0:24
enjoycrack30-Jul-07 0:24 
GeneralRe: preview a picture from my hard disk before upload it Pin
ayeleteric30-Jul-07 1:02
ayeleteric30-Jul-07 1:02 
GeneralRe: preview a picture from my hard disk before upload it Pin
Guffa30-Jul-07 1:13
Guffa30-Jul-07 1:13 
GeneralRe: preview a picture from my hard disk before upload it Pin
ayeleteric30-Jul-07 1:16
ayeleteric30-Jul-07 1:16 
GeneralRe: preview a picture from my hard disk before upload it Pin
ayeleteric30-Jul-07 2:59
ayeleteric30-Jul-07 2:59 
QuestionAutocompleteText of TextBox Pin
Imran Khan Pathan29-Jul-07 22:46
Imran Khan Pathan29-Jul-07 22:46 
AnswerRe: AutocompleteText of TextBox Pin
enjoycrack29-Jul-07 23:58
enjoycrack29-Jul-07 23:58 
Questionhow to assign QueryString value to a variable Pin
hurrem29-Jul-07 22:39
hurrem29-Jul-07 22:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.