PHP FTP

  • bluedragon
  • Proficient
  • Proficient
  • bluedragon
  • Posts: 452

Post 3+ Months Ago

I'm looking for an ftp/php script so people can upload there pictures without using another program. I need one that is fully editable kinda like the mirc scripts for your webpage.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Dark_Coder
  • Newbie
  • Newbie
  • Dark_Coder
  • Posts: 13

Post 3+ Months Ago

http://www.net2ftp.com

;)
  • bluedragon
  • Proficient
  • Proficient
  • bluedragon
  • Posts: 452

Post 3+ Months Ago

Yeah I tried that one... Cant get it to work.
  • Carnix
  • Guru
  • Guru
  • User avatar
  • Posts: 1098

Post 3+ Months Ago

By editable, you mean customizable? That is, you don't want some .exe file you can't actually change if you need to?

The file upload system in PHP is really very simple. I have all my PHP stuff at home and can't get to it from here, but I'll try to remember to post an upload script I did for freelance client a while back. I'd built them an ecommerce site, and for the product pages, they needed to be able to upload a photo and a PDF flyer per product.

Anyway, there is very little to it, unlike other languages (like ASP) where if you don't want a compiled program, you end up with a few hundred lines of code. I think mine isn't more than 10 or so. In fact, you could probably figure it out at http://www.php.net.

This is a function somone posted there. *I don't know if it works * But it looks like it should. I'm not 100% sure if it would work on an IIS version of PHP though, what with the chmod call... maybe it wouldn't matter though. Either way, this is a good start.

I found it on:
http://us4.php.net/manual/en/function.m ... d-file.php

Code: [ Select ]
function upload($filedir,$source,$source_name,$up_flag,$lastname)
{
  if (!file_exists($filedir))
  {
    mkdir($filedir,0777);
  }
  @chmod($filedir,0777);
  if (!$lastname)
  {
    $lastname=$source_name;
  }
  if (file_exists("$filedir/$lastname"))
  {
    if ($up_flag=="y")
    {
      @unlink($filedir/$lastname);
      @move_uploaded_file($source,"$filedir/$lastname");
      echo "$source_name OK<br>";
    }
    else
    echo "$source_name ...<br>";
  }
  else
  {
    @move_uploaded_file($source,"$filedir/$lastname");
    echo "$source_name OK<br>";
  }
}
  1. function upload($filedir,$source,$source_name,$up_flag,$lastname)
  2. {
  3.   if (!file_exists($filedir))
  4.   {
  5.     mkdir($filedir,0777);
  6.   }
  7.   @chmod($filedir,0777);
  8.   if (!$lastname)
  9.   {
  10.     $lastname=$source_name;
  11.   }
  12.   if (file_exists("$filedir/$lastname"))
  13.   {
  14.     if ($up_flag=="y")
  15.     {
  16.       @unlink($filedir/$lastname);
  17.       @move_uploaded_file($source,"$filedir/$lastname");
  18.       echo "$source_name OK<br>";
  19.     }
  20.     else
  21.     echo "$source_name ...<br>";
  22.   }
  23.   else
  24.   {
  25.     @move_uploaded_file($source,"$filedir/$lastname");
  26.     echo "$source_name OK<br>";
  27.   }
  28. }
  • bluedragon
  • Proficient
  • Proficient
  • bluedragon
  • Posts: 452

Post 3+ Months Ago

Yeah I'll try that thanks. But if anyone else also has some scripts I'll be more than glad to have them. Or if you have any in another language then thats fine too.
  • Carnix
  • Guru
  • Guru
  • User avatar
  • Posts: 1098

Post 3+ Months Ago

bluedragon wrote:
Yeah I'll try that thanks. But if anyone else also has some scripts I'll be more than glad to have them. Or if you have any in another language then thats fine too.


I have one that work's in ASP. Mostly, its a hack of some code I downloaded. Unfortunatly, it's pretty slow, so and it's designed to do more than one file at a time. Also, while it is probably possible, the script doesn't have a filesize check, and if the file is bigger than a meg or two, it will timeout and crash.

I'm using it currently on my personal website as part of an online photogallery system I wrote in ASP for my family (and inlaws) to be able to post photos online for each other. I'm planning to port the who thing to PHP eventually though... We'll see (=])

The problem is, you have to be able to set directory permissions on the server, which I can in my case to allow the IUSER full control over the directory you're uploading to. If you can't do that, then the ASP script won't help.

There are some ASP.NET scripts out there that work really well, since in .NET, there are finally some built-in file collection handling features (they were totally missing from all previous ASP versions). You might give that a Google too, if you're able to use .NET on your server.

.c
  • bluedragon
  • Proficient
  • Proficient
  • bluedragon
  • Posts: 452

Post 3+ Months Ago

Yay I got it fixed and I appreciate the help. I serched google for "html upload ftp" and it came up with some html codes.

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 84 guests
  • 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 post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.