Jump to content

Value in File Field


phpretard

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/120319-value-in-file-field/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/120319-value-in-file-field/#findComment-619922
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.