473,383 Members | 1,892 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,383 software developers and data experts.

Revisiting uploading a graphic w/ an OS X server

Hi all, thanks for all your help last time.. Unfortunately I couldn't get
any of the suggestions to work and because of time constraints I had to go
to something that I knew worked... But I'd like to revisit this because I
really want this option to run locally on the os x server...

Basically I have this string of code:

<?php
if($file_name !="")
{
copy ("$file", "/Library/WebServer/Documents/olcg/admin/$file_name")
or die("Could not copy file");
}
else { die("No file specified"); }
// If a ITL has been submitted,
// add it to the database.

if (@mysql_query($sql)) {
echo('<p><b><center>Your Tile Ad has been uploaded and
updated.</center></b></p>');
} else {
echo('<p>Error adding submitted ITL: ' .
mysql_error() . '</p>');
}
?>
<strong>Your Tile Graphic Has Been uploaded. </strong>
<ul>
<li>Sent: <?php echo "$file_name"; ?>
<li>Size: <?php echo "$file_size"; ?> bytes
<li>Type: <?php echo "$file_type"; ?>
</ul>
<p><img src="<?php echo "$file_name" ?>"> </p>

I keep getting the error Could not copy file... When I look at the error log
it tells me:

[Thu Feb 3 09:57:22 2005] [error] PHP Notice: Undefined variable:
file_name in
/Library/WebServer/Documents/olcg/admin/edit/tilegraphicsubmit.php on line
32
When I move this to a linux server running php 4 and mysql (the exact same
thing this server is running) it works great. Any help would be appreciated
in helping me figure out why this isn't working.


Jul 17 '05 #1
1 1194
ph*********@comcast.net wrote:
<?php
if($file_name !="")
{
copy ("$file", "/Library/WebServer/Documents/olcg/admin/$file_name")
or die("Could not copy file"); [snip] [Thu Feb 3 09:57:22 2005] [error] PHP Notice: Undefined variable:
file_name in
/Library/WebServer/Documents/olcg/admin/edit/tilegraphicsubmit.php on line
32


If that file is being run literally, then you have two problems.

First, it looks like you're coding to the register_globals option being
on, which is generally considered insecure and obsolete. The default is
to have this off. Go to http://www.php.net/register_globals for more
information.

Second, you've probably got a huge security hole, in that anyone with
access to this script over the web can copy arbitrary files on your
filesystem into web-readable space. You may also have SQL injection and
HTML/JavaScript injection vulnerabilities.

-- brion vibber (brion @ pobox.com)
Jul 17 '05 #2

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

Similar topics

6
by: Chamomile | last post by:
can anyone point me to some straightforward information on file uploading without using an html form? That is, direcly from within a php script. if I know the local path etc. to a particular...
5
by: Kevin Ollivier | last post by:
Hi all, I've come across a problem that has me stumped, and I thought I'd send a message to the gurus to see if this makes sense to anyone else. =) Basically, I'm trying to upload a series of...
1
by: Jonathan | last post by:
Hi everyone, I have a problem with the file uploading in Asp.Net and I have read a lot on forums on this but never found an answer. Here is the problem: I know Asp.Net maximum Length for...
13
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming...
3
by: Scott M. | last post by:
How can I give a client the ability to upload a graphic to a server and then have the server store it on its hard drive? Thanks.
3
by: Carlos | last post by:
Hello Forum, I would appreciate it if you could recommend settings to use auto-vacuum in my version 7.4 database. I am uploading several thousands records in the database at a rate of ~1 second...
3
by: Dean Richardson | last post by:
Hi, I'm having trouble uploading files via a PHP script. Whenever I upload a file greater than 10K, the file gets corrupted. However, text files upload OK. When I check the FTP Server log I...
1
by: Gabe Matteson | last post by:
'GRAB CONTENTS OF UPLOADED FILEDim intFileLen as Integer Dim objStream as streamintfilelen = txtfileupload.PostedFile.ContentLength Dim arrFile(intFileLen) as ByteobjStream =...
1
by: =?Utf-8?B?RGFu?= | last post by:
MS won't seem to let me reply to my old post, so I created a new one. The error occurs in all browsers. It's definitely a server issue, not client. The server is not proxied in any way. I tried...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.