Connecting Tech Pros Worldwide Help | Site Map

Upload files

  #1  
Old July 17th, 2005, 05:57 AM
Ken
Guest
 
Posts: n/a
I am trying to upload a file to an Apache2 server on Windows 2000 Pro.

The temp file name is being added to the database.

Everything seems to work except the file is not actually transferred to the
directory. I have searched the entire hard drive for the temp file name but
it is not saved.

I have tried both defining and not defining upload_tmp_dir in PHP.ini
Both directories have had share activated.

Any suggestions on what I am doing wrong?

Thanks.

Ken
-----------
Part of HTML table, input of file:
<?php
error_reporting(E_ALL);
// error_reporting(0);
session_start();
<form enctype="multipart/form-data" name="picture" method="post"
action="ty.php">
<input type="hidden" name="MAX_FILE_SIZE" value="2000000">

<input type="file" size="68" name="pictures"></td></tr>

------------------------
Part of ty.php
<?php
error_reporting(E_ALL);
// error_reporting(0);
session_start();
include('./store_data.php');
print("Name = ".$_FILES['pictures']['tmp_name']."<br><br>");
echo "Did file upload = ".is_uploaded_file
($_FILES['pictures']['tmp_name']);

---------------------------
store_data.php
<?php
error_reporting(E_ALL);
// error_reporting(0);
session_name('wiclassifiedads');
session_start();

--------------------------
Results:
Name = C:\PHP\uploadtemp\phpD5.tmp

Did file upload = 1

--------------------------------------
Insert into mysql database
mysql_query("INSERT INTO data (published, picture1, picture2) Values('not
published','not listed', '{$_FILES['pictures']['name']}')");
Do I need to actually write script to copy the file into the directory, or
does the mysql_query perform the task?

Ken











  #2  
Old July 17th, 2005, 05:57 AM
Ken
Guest
 
Posts: n/a

re: Upload files


Additional info:

I just added
echo "Error = ".$_FILES['pictures']['error'];

Results:
Error = 0

Ken

"Ken" <kkrolski@wi.rr.com> wrote in message
news:gq3ic.29950$lS2.18964@twister.rdc-kc.rr.com...[color=blue]
> I am trying to upload a file to an Apache2 server on Windows 2000 Pro.
>
> The temp file name is being added to the database.
>
> Everything seems to work except the file is not actually transferred to[/color]
the[color=blue]
> directory. I have searched the entire hard drive for the temp file name[/color]
but[color=blue]
> it is not saved.
>
> I have tried both defining and not defining upload_tmp_dir in PHP.ini
> Both directories have had share activated.
>
> Any suggestions on what I am doing wrong?
>
> Thanks.
>
> Ken
> -----------
> Part of HTML table, input of file:
> <?php
> error_reporting(E_ALL);
> // error_reporting(0);
> session_start();
> <form enctype="multipart/form-data" name="picture" method="post"
> action="ty.php">
> <input type="hidden" name="MAX_FILE_SIZE" value="2000000">
>
> <input type="file" size="68" name="pictures"></td></tr>
>
> ------------------------
> Part of ty.php
> <?php
> error_reporting(E_ALL);
> // error_reporting(0);
> session_start();
> include('./store_data.php');
> print("Name = ".$_FILES['pictures']['tmp_name']."<br><br>");
> echo "Did file upload = ".is_uploaded_file
> ($_FILES['pictures']['tmp_name']);
>
> ---------------------------
> store_data.php
> <?php
> error_reporting(E_ALL);
> // error_reporting(0);
> session_name('wiclassifiedads');
> session_start();
>
> --------------------------
> Results:
> Name = C:\PHP\uploadtemp\phpD5.tmp
>
> Did file upload = 1
>
> --------------------------------------
> Insert into mysql database
> mysql_query("INSERT INTO data (published, picture1, picture2) Values('not
> published','not listed', '{$_FILES['pictures']['name']}')");
> Do I need to actually write script to copy the file into the directory, or
> does the mysql_query perform the task?
>
> Ken
>
>
>
>
>
>
>
>
>
>
>[/color]


  #3  
Old July 17th, 2005, 05:57 AM
Agelmar
Guest
 
Posts: n/a

re: Upload files


You are not copying the file anywhere, so when your script finishes it's
going to delete the temporary file (or shortly thereafter). You need
something like
copy($_FILES['picture'][tmp_name'],
'C:/someOtherPlace/'.$_FILES['picture']['name']);

// Ian

"Ken" <kkrolski@wi.rr.com> wrote in message
news:gq3ic.29950$lS2.18964@twister.rdc-kc.rr.com...[color=blue]
> I am trying to upload a file to an Apache2 server on Windows 2000 Pro.
>
> The temp file name is being added to the database.
>
> Everything seems to work except the file is not actually transferred to[/color]
the[color=blue]
> directory. I have searched the entire hard drive for the temp file name[/color]
but[color=blue]
> it is not saved.
>
> I have tried both defining and not defining upload_tmp_dir in PHP.ini
> Both directories have had share activated.
>
> Any suggestions on what I am doing wrong?
>
> Thanks.
>
> Ken
> -----------
> Part of HTML table, input of file:
> <?php
> error_reporting(E_ALL);
> // error_reporting(0);
> session_start();
> <form enctype="multipart/form-data" name="picture" method="post"
> action="ty.php">
> <input type="hidden" name="MAX_FILE_SIZE" value="2000000">
>
> <input type="file" size="68" name="pictures"></td></tr>
>
> ------------------------
> Part of ty.php
> <?php
> error_reporting(E_ALL);
> // error_reporting(0);
> session_start();
> include('./store_data.php');
> print("Name = ".$_FILES['pictures']['tmp_name']."<br><br>");
> echo "Did file upload = ".is_uploaded_file
> ($_FILES['pictures']['tmp_name']);
>
> ---------------------------
> store_data.php
> <?php
> error_reporting(E_ALL);
> // error_reporting(0);
> session_name('wiclassifiedads');
> session_start();
>
> --------------------------
> Results:
> Name = C:\PHP\uploadtemp\phpD5.tmp
>
> Did file upload = 1
>
> --------------------------------------
> Insert into mysql database
> mysql_query("INSERT INTO data (published, picture1, picture2) Values('not
> published','not listed', '{$_FILES['pictures']['name']}')");
> Do I need to actually write script to copy the file into the directory, or
> does the mysql_query perform the task?
>
> Ken
>
>
>
>
>
>
>
>
>
>
>[/color]


Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Upload Files using the CGI.pm Module and Perl KevinADC insights 17 February 3rd, 2009 03:53 AM
Trying to upload files programmaticly mp33487@hotmail.com answers 3 June 27th, 2008 09:06 PM
Upload Files automatically avias answers 1 July 26th, 2007 06:41 PM
Upload files to UNC network path from webserver Tom Wells answers 2 November 19th, 2005 04:38 AM
Upload Files From Flash MX with ASPNet Jim Lewis answers 2 November 19th, 2005 03:29 AM