file upload related problem :-
----------------------------

i uploaded a file on the server in folder
'PhotoFolder' using php script. This script( script1 )

works fine.

# START : SCRIPT 1 

<?php
include 'queryString.php';
$upload = $vars['upload'];

if( $upload == 'Upload' )
{
        // The temporary filename of the file in which the
uploaded file was stored on the server.
        $tempFile = $HTTP_POST_FILES['file']['tmp_name'];
        // The original name of the file on the client
machine.
        $photoAttach = $HTTP_POST_FILES['file']['name'];
        // The mime type of the file, if the browser provided
this information. 
        // An example would be "image/gif". 
        $fileType = $HTTP_POST_FILES['file']['type'];
        // The size, in bytes, of the uploaded file. 
        $fileSize = $HTTP_POST_FILES['file']['size'];

        // upload the attachment file to destination folder
        move_uploaded_file( $tempFile,
"./PhotoFolder/".$photoAttach );
        $msg = 'File uploaded successfully.';
}
?>
<table>
<form name="uploadForm" enctype="multipart/form-data"
method="post">
<tr>
        <td><?php echo $msg;?></td>
</tr>
<tr>
        <td>Put your File here :</td>
</tr>
<tr>
        <td><input type="file" name="file" size="16"></td>
</tr>
<tr>
        <td><input type="submit" name="upload"
value='Upload'></td>
</tr>
</form>
</table>
# END : SCRIPT 1


Now my requirment is to uplode same file( only one
file browse button on the page ) to the two
different folder on the server - 'PhotoFolder' and
'PhotoFolder1'. For this i write script2.
but this script will not work properly. the file
uploaded in the 'PhotoFolder' successfully 
but uploading in the 'PhotoFolder1' failed.
this is because the second file(copy of first file)
was not uploaded via PHP's HTTP POST
upload mechanism.
IS THERE IS ANY SOLUTION TO THIS PROBLEM.
WAITING FOR YOUR COMMENT SO THAT I CAN UPLODE THE
SINGLE FILE TO TWO DIFFERENT FOLDERS ON THE
SERVER.

# START : SCRIPT 2

<?php
include 'queryString.php';
$upload = $vars['upload'];

if( $upload == 'Upload' )
{
        // The temporary filename of the file in which the
uploaded file was stored on the server.
        $tempFile = $HTTP_POST_FILES['file']['tmp_name'];
        // The original name of the file on the client
machine.
        $photoAttach = $HTTP_POST_FILES['file']['name'];
        // The mime type of the file, if the browser provided
this information. 
        // An example would be "image/gif". 
        $fileType = $HTTP_POST_FILES['file']['type'];
        // The size, in bytes, of the uploaded file. 
        $fileSize = $HTTP_POST_FILES['file']['size'];

        // copy the temporary file in the same folder on
server
        $copy_tempFile = dirname( $tempFile
).'/copy_'.basename( $tempFile );
        $copy_photoAttach = $photoAttach;
        $copy_fileType = $fileType;
        $copy_fileSize = $fileSize;

        copy( $tempFile, $copy_tempFile );

        // upload the attachment file to destination folder
        move_uploaded_file( $tempFile,
"./PhotoFolder/".$photoAttach );
        $msg1 = 'File1 uploaded successfully.';

        // FOR SECOND FILE

        $tempFile = $HTTP_POST_FILES['file']['tmp_name'] =
$copy_tempFile;
        $photoAttach = $HTTP_POST_FILES['file']['name'] =
$copy_photoAttach;
        $fileType = $HTTP_POST_FILES['file']['type'] =
$copy_fileType;
        $fileSize = $HTTP_POST_FILES['file']['size'] =
$copy_fileSize;

        // upload the attachment file to destination folder
        move_uploaded_file( $tempFile,
"./PhotoFolder1/".$photoAttach );
        $msg2 = 'File2 uploaded successfully.';
}
?>
<table>
<form name="uploadForm" enctype="multipart/form-data"
method="post">
<tr>
        <td><?php echo $msg1 . ' | ' . $msg2;?></td>
</tr>
<tr>
        <td>Put your Photograph here :</td>
</tr>
<tr>
        <td><input type="file" name="file" size="16"></td>
</tr>
<tr>
        <td><input type="submit" name="upload"
value='Upload'></td>
</tr>
</form>
</table>

# END : SCRIPT 2


                
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 




------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12h1nlk80/M=362329.6886308.7839368.1510227/D=groups/S=1705005703:TM/Y=YAHOO/EXP=1123773146/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992
">Fair play? Video games influencing politics. Click and talk back!</a>.</font>
--------------------------------------------------------------------~-> 

Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to