Your first question.  To see that the file uploaded successfully using the
web browser, one would have to have access to your computer's file system.
In her book, she used this merely as an example to show that the file had,
indeed, been uploaded.  This should not be used as something that you allow
your web users to do to confirm the receipt of the file.  Instead, send them
an email, show them a directory listing, etc.

Your second question, the name given to the image should be whatever the
*value* of the variable used to copy() it.  You should, however, come up
with a naming scheme that allows you to ensure that you do not overwrite any
uploaded files--especially if you expect a lot of traffic and/or users using
this feature.

Your third question, the mime-type pjpg is functionally the same as the
mime-type jpeg.  There's nothing you need to worry about there.


"Anthony Ritter" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Merry Christmas everybody.
>
> I am using MS Windows 98 with Apache and following an example in Julie
> Meloni's "PHP - Fast and Easy" (Chapter 10) in which she describes file
> uploading using PHP on page 168-174.
>
> She has two files:
> 1) an html form to receive the input from the user for the file to be
> uploaded
> 2) a .php script to accept the variable and use the copy() function.
> .............................................................
>
> The scripts are as follows:
> (html form)
>
> <HTML>
> <HEAD>
> <TITLE>Upload a File</TITLE>
> </HEAD>
> <BODY>
>
> <H1>Upload a File</H1>
>
> <FORM METHOD="post" ACTION="do_upload.php" ENCTYPE="multipart/form-data">
>
> <p><strong>File to Upload:</strong><br>
> <INPUT TYPE="file" NAME="img1" SIZE="30"></p>
>
> <P><INPUT TYPE="submit" NAME="submit" VALUE="Upload File"></p>
>
> </FORM>
>
> </BODY>
> </HTML>
> ................................................
> (.php script)
>
> <?
> if ($img1_name != "") {
>
> @copy("$img1", "c:/Program Files/Apache Group/Apache/htdocs/$img1_name")
> or die("Couldn't copy the file.");
>
> } else {
>
> die("No input file specified");
>
>  }
>
> ?>
>
> <HTML>
> <HEAD>
> <TITLE>Successful File Upload</TITLE>
> </HEAD>
> <BODY>
>
> <H1>Success!</H1>
>
> <P>You sent: <? echo "$img1_name"; ?>, a <? echo "$img1_size"; ?>
> byte file with a mime type of <? echo "$img1_type"; ?>.</P>
>
> </BODY>
> </HTML>
> ......................................................
>
> My questions:
> I am able to upload a file from My Documents  to the Apache server however
> in her book, she describes that the user can verify that the file was
> uploaded to the server by going to:
>
> File/ Open Page / in ones web browser to navigate through their filesystem
> to
> find the file that was uploaded.  There is a screenshot in the book that
> shows the .jpeg file on the screen with the browser at:
> file:///C/Apache/htdocs/blahblah.jpg
>
> I can't seem to verify that the file exists using this method.
>
> The only way I can verify that the file was indeed uploaded is to go into
> the folder within Apache that was specified in the path and check there.
>
> *How can I check by going through the browser window?*
>
> Next question:
>
> When I check that the file was uploaded, the file is saved in:
> C:/Program Files/Apache Group/Apache/htdocs/$img1_name
>
> as the *regular *.jpeg name I originally gave it - not the variable -
$img1.
>
> Is this correct? Or, should the file be saved as:
> img1?
>
> And the last question:
> This is the line I received upon sending the file:
>
> You sent: KewpieSmall.jpeg, a 3127 byte file with a mime type of
> image/pjpeg.
>
> In her book, it says:
> image/jpeg.
>
> What is:
> image/pjpeg.?
>
> Many thanks and best wishes to all for a happy and healthy new year.
> Tony Ritter
>
>
>
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to