>>>  Home   User-Center   Board
     
 

 
Post new topic   Reply to topic    Webhosting Forum » PHP & MySQL » How to mke a upload page
View previous topic :: View next topic  
Author Message
portalforums
Funnilein


Joined: 07 Nov 2005
Posts: 8

PostPosted: 19.11.05 22:29    Post subject: How to mke a upload page Reply with quote
I want to make a upload page so my home server can host pic's with out my members using their ftp access, dreamweaver has a template but it dosent work (can someone tell me how to do it, where to get a free one, or make me one) I would really appreaciate it and I want to make it so it wil tell them where the pic is located...
Back to top
View user's profile Send private message
kirth
Fun-Kleinkind


Joined: 27 Jul 2006
Posts: 17

PostPosted: 18.08.06 11:12    Post subject: Re: How to mke a upload page Reply with quote
portalforums wrote:
I want to make a upload page so my home server can host pic's with out my members using their ftp access, dreamweaver has a template but it dosent work (can someone tell me how to do it, where to get a free one, or make me one) I would really appreaciate it and I want to make it so it wil tell them where the pic is located...


So if i understand you well you want to make an upload site for your own?
This can be done wt PHP scripts,
but notice that theres an file limit at funpic.org (if im not correct plz say)so huge fiels cant be hosted,
also you will need to chek the Terms of Use to be sure this is legal and your site wont be deleted!
Back to top
View user's profile Send private message
ven
Moderator


Joined: 10 Dec 2004
Posts: 2064
Location: USA

PostPosted: 19.08.06 05:01    Post subject: Reply with quote
kirth, please don't quote posts directly above your own

portalforums, if I understand you correctly, you want to host the image files on your own server and not Funpic's? If that's the case, Funpic's file limitations really wouldn't apply, but, as kirth said, you would need to make use of PHP scripts. That's quite a bit more advanced than Dreamweaver Wink
_________________

Back to top
View user's profile Send private message
Jefftheman45
Fun-Member


Joined: 31 Dec 2005
Posts: 82
Location: USA

PostPosted: 19.08.06 06:49    Post subject: Reply with quote
The form page:

Code:
<form action="uploadrecieve.php" method="post">
<label for="file">File to Upload: (Limit: 1MB)</label>
<input type="file" id="file" name="file">
</form>


uploadreceive.php (A PHP page, possibly on your own server)

Code:
<?php
if(isset($_FILES['file']))
   {
   $filetype = explode(".", $_FILES['file']['name']);
   $filetype = $filetype[1];
      
   if($filetype == "jpg" OR $filetype == "jpeg" OR $filetype == "gif" OR $filetype == "bmp" OR $filetype == "png" OR $filetype == "tif")
   {
      $newfilename = time();
      
      if(move_uploaded_file($_FILES['file']['tmp_name'], "/newlocation/directorypath/{$newfilename}.{$filetype}"))
      {
         @mysql_connect("localhost", "username", "password") or die("Could not connect to database. Upload failed.");
         @mysql_select_db("username");
         
         $attempt = @mysql_query("INSERT INTO table (Name, Filename) VALUES ('{$_POST['title']}', '{$newfilename}.{$filetype}');");
         
         if($attempt)
         {
         print "Upload Successful. <a href=\"gallery.php\">Gallery</a><br /><br />";
         }
         else
         {
         print "Upload failed. <a href=\"gallery.php\">Gallery</a><br /><br />";
         unlink("{$newfilename}.{$filetype}");
         }
      }
   }
   
   else
      print "You cannot upload {$filetype}'s.<br /><br />";
   }
?>


Note: this code is untested. If it doesn't work, post here I guess. Also, this script will log the uploads in a database, indexing them, and it only allows certain filetypes.

Edit: It will also store files as a timestamp.extention. The timestamp is readable by date(), and it's the amount of seconds since the Unix epoch or whatever.

http://php.net/time
_________________
http://jefftheman45.funpic.org
http://jefftheman45.funpic.org/v4
Back to top
View user's profile Send private message
ven
Moderator


Joined: 10 Dec 2004
Posts: 2064
Location: USA

PostPosted: 19.08.06 20:54    Post subject: Reply with quote
Topic moved to a more appropriate section.
_________________

Back to top
View user's profile Send private message
lupus2k5
Guest





PostPosted: 20.08.06 03:29    Post subject: Reply with quote
But this would count as hosting files, and isn't that not allowed on Funpic? That would count as a web/file host (providing services to your users that Funpic provides you).
Back to top
Jefftheman45
Fun-Member


Joined: 31 Dec 2005
Posts: 82
Location: USA

PostPosted: 20.08.06 23:00    Post subject: Reply with quote
Photo album? This script only allows image files. Although it could be quite easily modified.

Edit: Also, you could use ftp functions to host it elsewhere.
_________________
http://jefftheman45.funpic.org
http://jefftheman45.funpic.org/v4
Back to top
View user's profile Send private message
alexweb
Funnilein


Joined: 08 Jun 2007
Posts: 5

PostPosted: 31.10.07 08:48    Post subject: &#1099; Reply with quote
Jefftheman45 wrote:
Photo album? This script only allows image files. Although it could be quite easily modified.

Edit: Also, you could use ftp functions to host it elsewhere.



Бугога ну вы аще
Back to top
View user's profile Send private message
Post new topic   Reply to topic    Webhosting Forum » PHP & MySQL

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Impressum Datenschutz