onlyican Posted June 16, 2008 Share Posted June 16, 2008 Hey all I have a form which allows a user to upload an image I want to create a preview of what the page they are creating looks like, so I want to show a preview of the image on the page without uploading the image So what I need to do is get the full path (The actual value shown in the form) to javascript I done the following //JavaScript bit ShowTempImage(FormImgVal){ alert ("Val is "+FormImgVal); } //HTM Bit <form method='post' action='' enctype='multipart/form-data'> <input type='file' name='UploadImg' id='UploadImg' onclick='ShowTempImage(this.value);' /> </form> And i get an alert saying the filename only, not the full path. Anyone know How i can get the full path without page reload Quote Link to comment Share on other sites More sharing options...
rhodesa Posted June 16, 2008 Share Posted June 16, 2008 For security reasons, I don't think you can do that. Google for an AJAX File Uploader. Then, when they click the "preview" button, use AJAX to upload the file to a temporary place, then use have the page show that temporary file. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted June 16, 2008 Share Posted June 16, 2008 Here is one of the many image preview scripts - http://javascript.internet.com/forms/image-upload-preview.html Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.