473,385 Members | 1,555 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.

Interesting File Upload problem...

Hi all,

I've been digging around on the newsgroups and the web for a possible
answer for this problem, but have so far come up with nothing so
thought I would ask here...

I have the following code doing a file upload...
$upload_result =
move_uploaded_file ( $_FILES['userfile']['tmp_name'],$dest_filename);

$chmod_result = chmod ($dest_filename, 0777);
The destination folder is set to permission 777, and the code above
reports success. Looking through an FTP client or SSH client I can
confirm that the file is there, and it's permission has been set to
777.

However... when I go to a browser and try to look at the file, the
browser reports;

Forbidden
You don't have permission to access /uploads/19.jpg on this server.

This doesn't make sense because I can see manually uploaded files in
that folder. Also (by luck) I also discovered that if I try to chmod
the uploaded file, I get the following error;

550 Could not change perms on [filename] : Bad file descriptor
I thought "aha - perhaps the file is corrupt", so downloaded it back
to my machine via FTP, and it appears to be fine so it's not that.

I also checked the hierarchy of folders (because the uploads folder is
within another folder), and confirmed that all the folders have
permission 777.

Does anybody have any idea whats going on?
Jul 16 '05 #1
3 3543
In article <3a********************************@4ax.com>, kafooey wrote:

$upload_result =
move_uploaded_file ( $_FILES['userfile']['tmp_name'],$dest_filename);

$chmod_result = chmod ($dest_filename, 0777);

[...]
However... when I go to a browser and try to look at the file, the
browser reports;

Forbidden
You don't have permission to access /uploads/19.jpg on this server.

This doesn't make sense because I can see manually uploaded files in
that folder. Also (by luck) I also discovered that if I try to chmod
the uploaded file, I get the following error;


1. Is '/uploads/' inside the webroot at all?

2. Are you sure there are no restrictions on '/uploads'? That is,
httpd.conf may not allow GET to that directory (which seems reasonable
or you'd have an open warez site on your hands).

Jul 16 '05 #2
On 7 Aug 2003 16:35:52 GMT, Martin Wickman <wi*****@hotbrev.com>
wrote:
In article <3a********************************@4ax.com>, kafooey wrote:

$upload_result =
move_uploaded_file ( $_FILES['userfile']['tmp_name'],$dest_filename);

$chmod_result = chmod ($dest_filename, 0777);


[...]
However... when I go to a browser and try to look at the file, the
browser reports;

Forbidden
You don't have permission to access /uploads/19.jpg on this server.

This doesn't make sense because I can see manually uploaded files in
that folder. Also (by luck) I also discovered that if I try to chmod
the uploaded file, I get the following error;


1. Is '/uploads/' inside the webroot at all?

2. Are you sure there are no restrictions on '/uploads'? That is,
httpd.conf may not allow GET to that directory (which seems reasonable
or you'd have an open warez site on your hands).


Uploads is inside the webroot.

e.g.
/pub/home/mywebsitename/htdocs/subfolder/uploads

I've put a support call in with the host (valuehost) so I'll see what
they come back with.
E-Mail :: ka*****@yahoo.co.uk
E-Blog :: http://www.pluggedout.com/blog
Jul 16 '05 #3
kafooey wrote:

<snippy snip>
1. Is '/uploads/' inside the webroot at all?

2. Are you sure there are no restrictions on '/uploads'? That is,
httpd.conf may not allow GET to that directory (which seems reasonable
or you'd have an open warez site on your hands).


Uploads is inside the webroot.

e.g.
/pub/home/mywebsitename/htdocs/subfolder/uploads


'/uploads' isn't inside the webroot.

'/pub/home/mywebsitename/htdocs/subfolder/uploads' (or whatever)
is.

If you are naming the folder correctly, then check your version of PHP,
since some have an issue with openbasedir and safe_mode
Jul 16 '05 #4

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

Similar topics

2
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give...
3
by: Bijoy Naick | last post by:
I've written a simple file upload user control in VB .NET. It comprises of an InputFile HTML Server Control, an Upload button and a message label. User clicks on the Browse button of the...
6
by: tshad | last post by:
I have an upload file input as: <input id="MyFile" style="width:300px" type="File" runat="Server"> This works fine, but I find that if my page doesn't pass validation during postback, the page...
18
by: Jen | last post by:
I'm using Microsoft's own VB.NET FTP Example: http://support.microsoft.com/default.aspx?scid=kb;en-us;832679 I can get the program to create directories, change directories, etc., but I can't...
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...
5
by: William LaMartin | last post by:
I have a VB ASP.Net application where the user can upload a file using the FileUpload server control. I also want a thumbnail to be created for this file. Unfortunately I can see no means to...
4
by: riteshjain82 | last post by:
Hi, Please go through this: I am having a file (default.asp) on which i am taking many details from a user before mailing it to someone. I have also provided the user with a facility of...
6
by: Vic Spainhower | last post by:
Hello, I am trying to do a FTP file upload which works fine on my localhost but on my ISP server it fails. I can't seem to find where I can go to find the specific cause of the failure. In both...
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"...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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: 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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...

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.