473,545 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
+ 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_f ile ( $_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 3551
In article <3a************ *************** *****@4ax.com>, kafooey wrote:

$upload_result =
move_uploaded_f ile ( $_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*****@hotbre v.com>
wrote:
In article <3a************ *************** *****@4ax.com>, kafooey wrote:

$upload_result =
move_uploaded_f ile ( $_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.c o.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
3911
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 them a caption, storing the caption and filename in a text file. It's a bit buggy when removing the photos and captions from the file, and also in...
3
2838
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 InputFile control, selects a file, then clicks on the Upload button. The file is saved to a folder on the server and the message label displays the...
6
4125
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 comes back with all the data intact, except for the upload object. The text box for "MyFile" (my example) is always cleared. Why is that and is...
18
4324
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 get it to upload a file to the FTP server. I just get a "Cannot connect to remote server" error after this TRY: s = New...
4
4455
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 one of my webform pages which includes a button that pops up a window where you can upload files, if you upload files in this popup window, it...
5
1587
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 determine when the file upload is complete so that I can use the MakeThumbnail function as part of the code. My current workaround is to supply an...
4
2384
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 uploading files on a server. I am uploading files from a page upload.asp which has a link on default.asp. Now my problem is that, how can i send the file...
6
3032
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 cases the file is being transmitted to the same FTP server and using the same PHP script so it shouldn't be a file size or login credentials...
7
3171
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" name="file_1" size=46 /><input type=submit /> so, after adding a few files, the input fields look like this:
0
7487
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...
0
7420
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7778
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...
0
6003
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...
1
5349
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4966
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...
0
3476
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...
0
3459
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1908
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.