Re: How to display JPG files that are stored on the user’s computer?
You've had a lot of replies saying that you can not
do this in PHP
While the PHP Script can't do it alone,
you can embed client side code to meet the need.
Several users suggested Java.
If you are open to an ActiveX solution ( requires browser
to be IE on Windows system ) then this becomses easy.
Our MetaDraw control can display local ( or remote)
JPGs ( or other image formats ) within a scrollable,
zoomable client side window. Also in Active X it
is easy to handle the directory listing and file
deletions ( if allowed by the user ).
If you are interested, contat me at
Jeff AT Bennet-Tec.com
============================
On May 4, 9:28am, PHPBABY3 <shymath...@gmail.com> wrote:
> I would like to do as follows:
>
> 1. The user identifies any directory on his computer.
> 2. I go through that directory and find all JPG files in it.
> 3. I display those JPG files.
>
> This is what I know:
>
> 1: The input type “file” would let them choose any file in that
> directory and send me the complete pathname (the drive, list of
> directories leading to it and file name.) I then ignore the file name
> at the end and I have the directory.
>
> Is there a way for them to browse to a directory and choose just a
> directory instead of a random file within that directory? This is
> minor, but still I am only asking for the drive and directories part
> of the pathname.
>
> 2: I can get a list of the file names in that directory using the
> opendir and readdir functions.
>
> 3: I go through the list of file names and want to use html IMG to
> display the JPG file. This is the real problem. How can I specify
> that the SRC is an arbitrary file on their computer? Using the
> pathname (drive, directories and file name) doesn’t work.
>
> I can get the contents of the file using the fopen and fread
> functions. But how do I specify the contents as the html SRC? Do I
> have to save the file contents to the server first? Then would I need
> to assign it a file name e.g. “A1”, “A2” etc? And then delete it
> after displaying it? And if there is a problem during that process
> and it doesn’t run to completion, I have to periodically delete these
> “A1” etc. file names that will not be deleted by the process that
> created them. How do I tell if it is a file that is currently being
> displayed and to not delete it?
>
> Thanks,
>
> P -
|