473,756 Members | 6,661 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

move_uploaded_f ile problem on Mac

Hi,

I am using Mac os10.3.3, running Apache and PHP 4.3.6
I am just starting to use my local Sites folder to test php for my
sites, but I cannot seem to get move_uploaded_f ile() or copy() to
work.
I assumed it was a file path error, but after trying every possible
file path combination, I dont think it is. I feel I have not done
something to php or apache to handle moving files locally.

Example:
<?PHP
$path = '/Users/myname/Sites/uploads/';
$file_name = $_FILES['file']['name'];
$temp_name = $_FILES['file']['tmp_name'];
$new_path = $path . $file_name;
move_uploaded_f ile($temp_name, $new_path);
?>

Firstly, is there anything I have done wrong with this code?
Has anyone had this problem before?
I appreciate any help.
Jul 17 '05 #1
1 5199
pa**@popimages. com (Paul Lamonby) wrote in message news:<86******* *************** ****@posting.go ogle.com>...
Hi,

I am using Mac os10.3.3, running Apache and PHP 4.3.6
I am just starting to use my local Sites folder to test php for my
sites, but I cannot seem to get move_uploaded_f ile() or copy() to
work.
I assumed it was a file path error, but after trying every possible
file path combination, I dont think it is. I feel I have not done
something to php or apache to handle moving files locally.

Example:
<?PHP
$path = '/Users/myname/Sites/uploads/';
$file_name = $_FILES['file']['name'];
$temp_name = $_FILES['file']['tmp_name'];
$new_path = $path . $file_name;
move_uploaded_f ile($temp_name, $new_path);
?>

Firstly, is there anything I have done wrong with this code?
Has anyone had this problem before?


Try adding the following two lines in the beginning of all your scripts:

error_reporting (E_ALL);
ini_set('displa y_errors', 1);

--
| Just another PHP saint |
Email: rrjanbiah-at-Y!com
Jul 17 '05 #2

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

Similar topics

5
7646
by: neo002244 | last post by:
The move_uploaded_file() function is very quirky. I want to allow users to upload images to the Web site. Here is the code: if(!move_uploaded_file($_FILES, $imagefile)) { die("Could not move file: ".$_FILES." -> $imagefile"); } else { enter record into database...
1
3017
by: Felix Natter | last post by:
hi, I would like to upload a file (via a form), then read that (temporary) file and write the contents into a database. The first problem is that open_basedir=/home/CUSTOMER so I can't just read it from /tmp. That's why I used move_uploaded_file() to move the file to /home/CUSTOMER/DOMAIN/tmp/FILENAME: ======================================================
1
10682
by: sa | last post by:
Trying to upload a file using win xp/iis/php. I've given full access to all accounts trying to get this to work? Yet I'm still getting read errors. Simplified the script below to the bare minimum. simpleupload.php <form enctype="multipart/form-data" action="upload.php" method="post"> <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="200000"/>
6
3374
by: Stijn Goris | last post by:
HI all, I have created a script that allows a user to upload a picture. I have an IIS server runing on my own pc but the actual site runs an Apache server. The upload script worked perfectly on my IIS but refuses to work on the Apache. All I know is that the script stops working at move_uploaded_file() function. The warnings echo'ed are: Warning: move_uploaded_file(images/nieuws/TIDEEY%7E1.jpg): failed to open
2
16298
by: Brian | last post by:
Hi I am moving a site to a new server, I have been testing it and one of the pages uses move_uploaded_file, but I get a Permission denied. The directory I am moving it to is chomd of 755, if I change it to 777 it does upload but the owner is www-data, but I then can't download it using a FTP client (which I have to do) as it's the wrong owner, so I have to leave the chomd as 755, but
1
4237
by: comp.lang.php | last post by:
Consider my code: if ($this->isSuccessful && is_file($_FILES)) { // STEP 6: MOVE RESUME TO DIRECTORY $uuid = $this->sfug->getUUID(); if (!$uuid) $this->sfug->setUUID(); $uuid = $this->sfug->getUUID();
5
3373
by: bill | last post by:
I can validate that the file uploaded because is_uploaded_file() returns true. --------- if (is_uploaded_file($_FILES)) { echo "File ". $_FILES ." uploaded successfully.<br />"; } ------------------------ When I try to move the file using move_uploaded_file it fails. --------------
7
2083
by: nicemotion | last post by:
Hi all, the following easy script correctly insert a record in the DB but is not moving the images (Logo and Foto) to the server /foto folder. can't understand why 'cause the script is easy and correct and i guess it loses the $file_temp var (actually the printout of $file_temp0 return nothing) i even tryed to write it repeating the parameters i/o using variables
3
7608
by: groupie | last post by:
Hi, The code below is working - it returns the 'Received' message, however I cannot find the uploaded file in the destination folder, or anywhere else (other than source directory). I'm running PHP 5.2.5 on my PC running Apache 2.0. Thanks. <?php $uploadDir = "/uploads"; $temp = $uploadDir;
0
9456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10040
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9873
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9846
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9713
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8713
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3359
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.