GetDotted Domains

Viewing Thread:
"Uploading files using PHP"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Thu 03/03/05 at 22:33
Regular
"PC Gaming Founder"
Posts: 2,136
Hi all, long time no post!

Want to knock together an online file stash rather quickly for a group project at uni. When it comes to webscripts, the only language I know is PHP (or at least the basics of it).

First step is to get the script to actually allow the user to upload a file to my web server (I'll worry about listing uploaded files later).

Here's my effort so far:

[URL]http://www.newslinks.co.uk[/URL]

At the moment, I've restricted it to image files only, but I can't get it to work - something along the lines of "failed to open stream: Permission denied in /home/newslinksuk/public_html/index.php on line 34".

My code can be provided if required.

Any prompt help would be greatly appreciated, as this would be a valuable tool for my team.

Oh, and if anyone knows of a free service on the web that does such a thing, please let me know - no point trying to reinvent the wheel!
Sat 05/03/05 at 10:53
Regular
Posts: 78
I've had alot of success with a cgi script called Fileman.
Fri 04/03/05 at 12:09
Regular
"PC Gaming Founder"
Posts: 2,136
monkey_man wrote:
> You can normally just right click a folder and look at the properties.
> Then change the mode to '0777', or mke sure all the boxes are
> checked and ok it.

Woohoo, finally got it working. Thanks for the hint. ;)

Now just got to get it to list all files for others to download, but there looks like there's loads of functions under the Filesystem heading on php.net that should make this relatively straightforward (famous last words)!

Thanks for the continued support all. :)
Fri 04/03/05 at 09:56
Regular
"Pouch Ape"
Posts: 14,499
You can normally just right click a folder and look at the properties. Then change the mode to '0777', or mke sure all the boxes are checked and ok it.
Fri 04/03/05 at 08:54
Regular
"PC Gaming Founder"
Posts: 2,136
Nimco wrote:
> A permission denied error sounds as though you haven't correctly
> CHMODed the directory you're uploading to, or it's otherwise denied
> through php.ini or somethign.

Well I've been in touch with my webhost support, and they've said I can't use the ftp functions in PHP but I can use move_uploaded_file(). If the permissions aren't set up correctly at the mo, can you explain to me how to change the permissions of the directory? I'm using Filezilla as my FTP program if that helps. :)
Fri 04/03/05 at 00:29
Regular
"NULL"
Posts: 1,384
A permission denied error sounds as though you haven't correctly CHMODed the directory you're uploading to, or it's otherwise denied through php.ini or somethign.
Thu 03/03/05 at 23:39
Regular
"Pouch Ape"
Posts: 14,499
Oops, haven't got my memory stick with all my files on it. It's easy though - I found my biggest problem was setting the correct directory to upload to, it's not as straight-forward as it looks.
Thu 03/03/05 at 23:01
Regular
"PC Gaming Founder"
Posts: 2,136
That's for that, I see there's lots of ftp functions you can use in PHP. I'll have a play and report back. :)
Thu 03/03/05 at 22:45
Regular
"Pouch Ape"
Posts: 14,499
You can do it with quite a short piece of standard code called ftp_put(). Look it up on php.net, it'll show you exactly how to use it. You'll need to know how to change directory, and a few other things too, hang on...
Thu 03/03/05 at 22:33
Regular
"PC Gaming Founder"
Posts: 2,136
Hi all, long time no post!

Want to knock together an online file stash rather quickly for a group project at uni. When it comes to webscripts, the only language I know is PHP (or at least the basics of it).

First step is to get the script to actually allow the user to upload a file to my web server (I'll worry about listing uploaded files later).

Here's my effort so far:

[URL]http://www.newslinks.co.uk[/URL]

At the moment, I've restricted it to image files only, but I can't get it to work - something along the lines of "failed to open stream: Permission denied in /home/newslinksuk/public_html/index.php on line 34".

My code can be provided if required.

Any prompt help would be greatly appreciated, as this would be a valuable tool for my team.

Oh, and if anyone knows of a free service on the web that does such a thing, please let me know - no point trying to reinvent the wheel!

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

The coolest ISP ever!
In my opinion, the ISP is the best I have ever used. They guarantee 'first time connection - everytime', which they have never let me down on.
Thanks!
Thank you for dealing with this so promptly it's nice having a service provider that offers a good service, rare to find nowadays.

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre
Feedback Close Feedback

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.