473,495 Members | 2,058 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 3548
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
3909
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
2833
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
4119
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
4313
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
4448
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
1578
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
2379
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
3028
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
3165
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"...
0
7120
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,...
0
6991
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7160
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,...
0
7196
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...
1
6878
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...
0
5456
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,...
0
4583
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...
0
3088
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...
1
649
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.