PHP Classes

example please! :)

Recommend this page to a friend!

      Upload Images  >  All threads  >  example please! :)  >  (Un) Subscribe thread alerts  
Subject:example please! :)
Summary:need form example utlizing all the methods
Messages:5
Author:Greg Milby
Date:2013-09-20 13:14:11
Update:2013-11-19 06:16:23
 

  1. example please! :)   Reply   Report abuse  
Picture of Greg Milby Greg Milby - 2013-09-20 13:14:11
can you provide an example that utilizes all the methods please?

Thank you!
:)

  2. Re: example please! :)   Reply   Report abuse  
Picture of saadi ali saadi ali - 2013-09-23 10:53:58 - In reply to message 1 from Greg Milby
include("class_images.php");

$field = 'field';
$folder = 'upload';
$allowed = array("JPG",'GIF','PNG');

$upload = new upload($field, $folder, $allowed, false, $folder, 200, 150);

if($upload->error() == 0){
if($upload->error_ext()){
echo "error extension";
}
$upload->new_name();
if($upload->up(true)){
echo "Uploaded successfully";
}
}else{
echo "field empty";
}

  3. Re: example please! :)   Reply   Report abuse  
Picture of Koptev Koptev - 2013-11-15 05:34:55 - In reply to message 2 from saadi ali
Hello Saadi!
I'm beginner in PHP --> define ('$me','noob')

I try to use your class on my website for photos upload.
Unfortunately I got 'error extension' every time i use it.

My form for file uploading:

<form enctype="multipart/form-data" method="post" action="file-upload.php">
<input type="file" name="photo" />
<input name="submit" type="submit" value="Upload" /></form>

In file-upload.php I've used your example:

include ("../includes/class_images.php");

$field = 'field';
$folder = '../photo/';
$folder_thumb = '../photo/thumb/';
$allowed = array("JPG","GIF","PNG","jpg","gif","png","JPEG","jpeg");
$upload = new upload($field, $folder, $allowed, false, $folder_thumb, 200, 150);

<snip>

What I did wrong?
Your help will be much appreciated!

Thanks,
Oleg

  4. Re: example please! :)   Reply   Report abuse  
Picture of saadi ali saadi ali - 2013-11-17 10:49:17 - In reply to message 3 from Koptev
Hello

$field = 'photo';

$field is the name of <input type="file" name="photo" />

//------
I apologize for the delay in a reply

  5. Re: example please! :)   Reply   Report abuse  
Picture of Koptev Koptev - 2013-11-19 06:16:23 - In reply to message 4 from saadi ali
Thank you very much!!!