Solved

UPLOAD ERROR: move_uploaded_file FILENAME failed to open stream: Permission denied on line #

Posted on 2004-09-25
5
323 Views
Last Modified: 2013-12-13
I'm getting the error on title when trying to upload a text file to a Windows server. I'm developing on a localhost windows computer, and I can upload internally without problems, however when using the same script to upload a 300K text file in the remote Windows server it sends the warning on the title.

There was a similar problem listed in this forum, but the remote server was Unix, so the answer does not apply here. I tried that solution (ftp a file with the exact same name in the remote location and CHMOD it to 777) but since it is a Windows server CHMOD does not work. I only have FTP access to the remote server.

Help is sincerely appreciated.
0
Comment
Question by:aixarat
  • 2
  • 2
5 Comments
 
LVL 9

Expert Comment

by:techtonik
ID: 12155086
If you have only FTp access, then you cannot do anything except to contact your hosting support team on this issue so they can change configuration to allow webserver upload/write privileges to your chosen direcory.
0
 

Author Comment

by:aixarat
ID: 12155410
So there's no run-time override?
0
 
LVL 49

Expert Comment

by:Roonaan
ID: 12156197
Well, as the error occurs when executing move_uploaded_file, you could open - in your phpscript - an ftp connection and move the file using this connection from the temporary upload dir to the dir you require it to be. Possible problems could be the max numbers of ftp connections and slow ftp servers. But it sure would be a workaround, which in your case could be handy.

-r-
0
 

Author Comment

by:aixarat
ID: 12160043
The reason that I'm trying to use move_uploaded_file is that I'm trying to build a simple file uploading system for a feature in a particular website. I'm already FTPing to gen my files on place.
I'm thinking about a possible workaround: is there a way to directly open the uploaded file without moving it to a new folder? I suppouse that will also require me to delete it from the temp folder... Any comments?
0
 
LVL 49

Accepted Solution

by:
Roonaan earned 250 total points
ID: 12160076
One of the items in the $_FILES arrays is the filename of the temporary file.

You could use file() or file_get_contents() to get the contents of this temporary file.

Use print_r($_FILES) to find the correct key, as I don't know it from heart.

-r-
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now