phpretard Posted August 19, 2008 Share Posted August 19, 2008 I am trying to poulate the file field from a database that already has the path the image or not. either way i would like for the file field to show what is in the DB and process the result of a submit wether it is changed or not changed. Is this even posible? $img1="path/to/image.jpg" Image 1<input type=file name='img1' value='$img1'> ////UPLOAD SCRIPT $rand=rand(111111, 999999); $uploaddir = "projects/$title"; $path1 = $uploaddir . $rand."-".basename($_FILES['img1']['name']); move_uploaded_file($_FILES['img1']['tmp_name'], $path1); The field shows blank with the script I am using now. Any thoughts? Quote Link to comment Share on other sites More sharing options...
phpretard Posted August 19, 2008 Author Share Posted August 19, 2008 Not Possible. Quote Link to comment Share on other sites More sharing options...
Fadion Posted August 19, 2008 Share Posted August 19, 2008 You said impossible, but that should be difficult. I've seen file fields styled with custom buttons which absolutely sit on top of the file field (cant find the url) and trigger it. That can be used in your case too, where your [visible] file field is just a textfield and a button and it actually shows values from the db, but also gets values (with javascript) from the real file field. Don't know if i'm explaining this right, but what's the most important, if it's worth bothering so much. It's just an aesthetic option. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted August 19, 2008 Share Posted August 19, 2008 The value in a form type="file" field is read-only (as far as any HTML statement or script is concerned.) It can only be set by the browser's file selection dialog box. 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.