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 Link to comment https://forums.phpfreaks.com/topic/110408-get-full-path-with-js-from-form-file-type/ 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. Link to comment https://forums.phpfreaks.com/topic/110408-get-full-path-with-js-from-form-file-type/#findComment-566499 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 Link to comment https://forums.phpfreaks.com/topic/110408-get-full-path-with-js-from-form-file-type/#findComment-566517 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.