Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
Allow visitors to upload files
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- Re: Allow visitors to upload files
Allow visitors to upload files
06-09-2007 8:42 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I want to be able to allow visitors to my FP site to upload their images via the file upload control but the properties of the destination folder are disabled so therefore i cannot allow the destination folder to receive files.
Any ideas?
Any ideas?
Message 1 of 4
(2,813 Views)
3 REPLIES 3
Re: Allow visitors to upload files
07-09-2007 11:34 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
The error message i get when i try to upload a file is as follows:
Cannot run the FrontPage Server Extensions on this page: "http://fp.mywebspace.plus.com/submitimage.htm"
I am trying to provide an image upload feature to my site using the FP file upload componenent
Is this an unavailable feature on the FP server?
Cannot run the FrontPage Server Extensions on this page: "http://fp.mywebspace.plus.com/submitimage.htm"
I am trying to provide an image upload feature to my site using the FP file upload componenent
Is this an unavailable feature on the FP server?
Message 2 of 4
(591 Views)
Re: Allow visitors to upload files
11-09-2007 1:43 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I think i've given up on this now, no one was answering anyway.
I think a better option might be to put my site on the cgi server and achieve the file upload via php scripts where i can also do a lot more dynamically.
Trouble is, i don't know much about php, all the examples i've tried for uploading files don't work, most likely because i am not aware of all the different bits i need
Will someone please post a working example of some php code that will allow a website visitor to upload an image.
This is my upload.php
The upload.php above is called from the following submitimage.htm
Although it appears to work in that the message displayed at the end gives the impression the file was uploaded sucesfully, the image does not appear on the server where i expected it to be.
I think a better option might be to put my site on the cgi server and achieve the file upload via php scripts where i can also do a lot more dynamically.
Trouble is, i don't know much about php, all the examples i've tried for uploading files don't work, most likely because i am not aware of all the different bits i need
Will someone please post a working example of some php code that will allow a website visitor to upload an image.
This is my upload.php
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<body>
<?php
$uploaddir = 'ftp://ccgi.username.plus.com/images/';
$uploadfile = $uploaddir . basename($_FILES['imagefile']['name']);
if (is_uploaded_file($_FILES['imagefile']['tmp_name'])) {
echo "File ". $_FILES['imagefile']['name'] ." uploaded successfully.\n";
echo "Displaying contents\n";
readfile($_FILES['imagefile']['tmp_name']);
} else {
echo "Possible file upload attack: ";
echo "filename '". $_FILES['imagefile']['tmp_name'] . "'.";
}
?>
<p>File name to be uploaded = <?php echo $_FILES['imagefile']['name']; ?></p>
<p>Upload location = <?php echo $uploadfile; ?></p>
</body>
</html>
The upload.php above is called from the following submitimage.htm
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<body>
<form method="POST" action="upload.php" enctype="multipart/form-data">
<!-- MAX_FILE_SIZE must precede the file input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<!-- Name of input element determines name in $_FILES array -->
<input type=file name="imagefile" value="Image file submitted">
<p><input type="text" name="T1" size="20"></p>
<p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
</body>
</html>
Although it appears to work in that the message displayed at the end gives the impression the file was uploaded sucesfully, the image does not appear on the server where i expected it to be.
Message 3 of 4
(591 Views)
Re: Allow visitors to upload files
15-09-2007 12:39 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
What you have should only need one change to get it working. In the upload.php you need to change the $uploaddir to the path to your space, which can be obtained by running 'pwd' whilst connected with Putty (or your preferred client) For reference, I've included a copy of the appropriate code in mine.
Edit: Though after reading through some other posts it would appear that you've found an alternate way of doing what you were after, so I'll just leave this here for anyone else who has similar issues.
$uploaddir = '/var/www/html/choc-cha/images/';
$uploadname = basename($_FILES['userfile']['name']);
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}
Edit: Though after reading through some other posts it would appear that you've found an alternate way of doing what you were after, so I'll just leave this here for anyone else who has similar issues.
Message 4 of 4
(591 Views)
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- Re: Allow visitors to upload files