473,385 Members | 1,331 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Upload files

Ken
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



Jul 17 '05 #1
2 1889
Ken
Additional info:

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

Results:
Error = 0

Ken

"Ken" <kk******@wi.rr.com> wrote in message
news:gq*******************@twister.rdc-kc.rr.com...
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




Jul 17 '05 #2
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" <kk******@wi.rr.com> wrote in message
news:gq*******************@twister.rdc-kc.rr.com...
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




Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tihon | last post by:
Hello! I again need your help, just can't understand whats going on. Got this upload pictures form and it's having problem handling large files (~1.5 - 2 MB). Everything works fine if i just...
3
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
4
by: Matt Jensen | last post by:
Howdy I've got a rather strange issue occuring. I used forms based .NET authentication, although I'm also setting some session variables when people login. However, I've found when people use...
0
by: SEMIH DEMIR | last post by:
Sitelerden birinde verilen yabancı kaynakli bir scriptti duzenledim yanlız birseyin içinden bir turlu cıkamadım işin aslı ilk defa persistin upload componentini kullanacam yanlız suanki haliyle...
9
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web...
7
by: pbd22 | last post by:
hi. i am having probs understanding how to grab a file being uploaded from a remote client. i am using hidden input fields for upload such as: <input id="my_file_element" type="file"...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
5
by: camphor | last post by:
hi, I have found an upload script in hotscripts and have implemented it into the website, I followed the installation steps to 'give write permissions to php on the upload folder (which is...
4
by: MoroccoIT | last post by:
Greetings - I saw somewhat similar code (pls see link below) that does mupltiple files upload. It works fine, but I wanted to populate the database with the same files that are uploaded to...
1
by: achotto | last post by:
hi, i try to upload a multiple image files. after that i will rename the files name. the problem is when i upload a 2 or more same files name exp-goal.jpg, it will return "files already exist". ok...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.