saddam_hossain — 2012-01-30T08:55:01-05:00 — #1
Can anyone tell me how to insert value in input type="file" ?
If anyone knows please reply.
anthonysterling — 2012-01-30T08:59:45-05:00 — #2
No, it is forbidden due to the possible security implications.
saddam_hossain — 2012-01-30T09:16:51-05:00 — #3
Then how to retrieve data from database for an image ?
raju_gautam — 2012-01-30T10:08:47-05:00 — #4
This is normally done by:
- Display the image from the database in <IMG> tag
- Have another file browse field for changing the new one.
Hope you understand what I mean!
michael_morris1 — 2012-01-30T10:10:24-05:00 — #5
That (getting file information for an uploaded file) is possible. When a file is uploaded a superglobal called $_FILES will be populated. It contains information on the file's size, where it was stored in the tmp file system (you'll have to move it from there to your database or permanent file system storage), and the mime type.
PHP Manual entry on handling file uploads.
ultra1 — 2012-01-30T16:02:11-05:00 — #6
It's not possible to have the value of file path in your upload form pre-populated.
If it was possible someone could write a form that pre-populates file input with a path to some private file on your computer, then if you don't notice it an press "submit" it would just grab your file and send it to their server.
michael_morris1 — 2012-01-30T16:17:13-05:00 — #7
And that wouldn't even be that hard since file architectures are fairly predictable - especially Windows and Mac - Linux less so due to all the distros floating about.