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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.