Jump to content

Recommended Posts

Posted

i gave been given the task of creating a website for someone.

 

The asked for someway to upload a file on the website.

 

Is there any way to do this and also show uploaded files on the page?

 

Thanks

Peter

Posted

tried the post by mossj

 

did everything it asked and getting

 

"No such file or directory in E:\domains\k\kingsbridgecluster.co.uk\user\htdocs\upload_file.php on line 25"

 

anyone know?

 

Thanks

Peter

Posted

If you want to go the FTP route:

 

PHP: ftp_connect - Manual

 

FTP_CONNECT()

 

&

 

FTP_PUT()

 

$file = 'somefile.txt';
$remote_file = 'readme.txt';

// set up basic connection
$conn_id = ftp_connect($ftp_server);

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

// upload a file
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
echo "successfully uploaded $file\n";
} else {
echo "There was a problem while uploading $file\n";
}

// close the connection
ftp_close($conn_id);
?> 

 

Put your form within here and do it this way (if it has to be FTP).

  • Thanks 1
Posted
If you want a very basic FTP application, explorer has a built in FTP client. You could create a shortcut and it would literally be "drag and drop" into the folder.
  • Thanks 1
Posted
If you want a very basic FTP application, explorer has a built in FTP client. You could create a shortcut and it would literally be "drag and drop" into the folder.

 

I have got a link to the ftp server which is hosted by an external company. when i click the link it comes up with the username and password. i only have one to access it. Would there by anyway of making a new username and password for the users (prob only need one) or will i have to ring the company?

 

Thanks

Peter

Posted
I have got a link to the ftp server which is hosted by an external company. when i click the link it comes up with the username and password. i only have one to access it. Would there by anyway of making a new username and password for the users (prob only need one) or will i have to ring the company?

 

Thanks

Peter

 

Yes, just ask you host to reset your password.

Posted

or if your host has a cpanel, create yourself a new FTP account with access to what needs accessing. Saves on "accidents" later :D

 

( myurl .com/cpanel)

Posted

nah doesnt have a cpanel.

I was just given this to carry on with.

 

All i need is a folder /ftp server/uploads to be able to have access by people so they can put documents on, view them but not delete. But when i come to change permission it is saying i dont have permission to do so. -_-!

 

Peter

Posted
The other thing you need to be really careful with is checking who can get to this page to upload - if it's open to the world then the world will use it. In no time at all, you'll find your ftp space full of "warez" or just a denial of service attack mounted against you!
Posted

just rang the comapny up and they said it isnt possible to do what i want.

 

Know i have to buy a web server and link the current web address to it.

 

How can i do this? Been told i have to contact the council to allow it.

Posted
Any good hosting provider should allow you to create multiple FTP accounts. If you have to contact the council, it's probably just another silly lengthy procedure for a 2 minute job. Alternatively you could go with a real hosting provider if the funds are available.
Posted

What are the files? What are you actually trying to achieve? There may be easier ways to do this (and safer) - for example, uploading the files to a 3rd party service (eg. flickr if they are images only) and hotlinking them.

 

There's also the option of picking up some cheap webspace and then linking people to that yourself - this way you don't move the main site/domain, and any issues/compromises on the file hosting would be contained.

 

Otherwise "file upload" forms will work if you have the requisite permissions - but these are dangerous tools in inexperienced hands.

Posted (edited)

or you could use joomla to create the site (you can pick up free templates, and its easy to install (even easier if your new host offers up to date one click installers))then you can upload the files using remository or docman.

 

Here is an example of a site using remository that allows users to upload files Ashlawn School - Useful Downloads

Edited by mossj
Posted

I think the FTP part of the question is a red herring - a file upload PHP/ASP script would let you accept the files and drop them onto the server via HTTP and the server's file system.

 

Security is a major concern though as has been pointed out. At the very minimum you'd want to limit it to specific file extensions and a file size limit. And then be very careful how you use the files!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...