Accepting Files

Started on the old forum in October 2009 · view the original in the archive · old links redirect here

8 replies · 574 views · started 17 years ago · 1 min read

5 participants
riderz Lead · 975 posts #1

Who have the code to accept any files that get uploaded to site

when ppl upload pictures or downloads it must send a request for the owners to accept the incomming file


Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

WhiteWarrior Principal · 1,419 posts #2

Use the vaildate rule... get it from a lava script

crazybrumi Super moderator Principal · 1,064 posts #3

yup i coded this for my site, iv got a row called approved in the gallery table, when they upload it its set to default as 0, but when you validated it you set it to 1.

remember when you want to see the pic make sure u have it like WHERE approved = 1 so that it will only show images that hav been approved. this also helps to cut down on phpthumb memory, as you only have thumbs when you validate the picture onces its passed validation you dont need to place thumbs to view it....

Want something coded email me at sales@webnwaphost.com for a prices.

http://flagcounter.com/more/W80q

riderz Lead · 975 posts #4

so can staff view the file that get uploaded before validate it?


Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

Mysterio Lead · 630 posts #5

riderz, as crazybrumi said, WHERE approved = 0 is going to show you the non approved file. Then, and update to the table of downloads SET approved='1' WHERE id='$fileid' should work to Approve it.

mysterio.al - programming is a functional art

friend Developer · 112 posts #6

riderz wrote: Who have the code to accept any files that get uploaded to site

when ppl upload pictures or downloads it must send a request for the owners to accept the incomming file

very good idea 🙂

Guest #7

Or even better. Create a secure up loader. All my sites has one which I coded myself.

Guest #9

riderz wrote: why not share one then

if ($Submit){ if ($_FILES['image']['name']==''){ $error_msg = 'Please select a file'; $error = 1; }

if (!$error){
  $uploaddir = 'userimages/';
  $file_name = rand(1,999).$_FILES['image']['name'];

  if ($_FILES['image']['size'] >= 30721) {
      $error_msg = "Your file is larger than 30KB.";
      $upload_error = 1;
  }
  $file_type = "image";
  $image_type = $_FILES['image']['type'];
  $pos = strpos($image_type, $file_type);
  
  if ($pos === false) {
      $error_msg = "You cannot upload files of this type";
      $upload_error = 1;
  }
  
  $file_info = getimagesize($_FILES['image']['tmp_name']);
  
  if(empty($file_info)) {
        $error_msg = "The uploaded file doesn't seem to be an image.";
      $upload_error = 1;      
  }
  
  if (!$upload_error) {          
  move_uploaded_file($_FILES['image']['tmp_name'], $uploaddir.$file_name);
  // YOUR MYSQL QUERY GOES HERE
  if ($res) $error_msg = "Your file was uploaded sucessfully";
  else $error_msg = "Error occured, please try again";
  }
}

}

That is just a simple uploader to make sure that only images is uploaded. You can go further and allow all file types but then hide the upload directory and or make files only down loadable. I do both.

If anyone want the any file type up loader with the only down loadable script, make me an offer. I am running a business after all. 🙂

PS : The script above is only the upload part and does not include the HTML/XHTML Form

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close