Solved

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

Posted on 2004-09-25
5
328 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to dynamically set the form action using jQuery.
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…

770 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