fixnew
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
include_once('def.php');
|
||||
include 'session_read.php';
|
||||
include('wrenchboard_class.php');
|
||||
$wrenchboard = new wrenchboard_class();
|
||||
|
||||
if(isset($_FILES['image'])){
|
||||
$errors= array();
|
||||
$file_name = $_FILES['image']['name'];
|
||||
$file_size =$_FILES['image']['size'];
|
||||
$file_tmp =$_FILES['image']['tmp_name'];
|
||||
$file_type=$_FILES['image']['type'];
|
||||
$file_ext=strtolower(end(explode('.',$_FILES['image']['name'])));
|
||||
|
||||
$extensions= array("jpeg","jpg","png","bmp","svg");
|
||||
|
||||
if(in_array($file_ext,$extensions)=== false){
|
||||
$errors[]="extension not allowed, please choose a JPEG or PNG file.";
|
||||
}
|
||||
|
||||
if($file_size > 2097152){
|
||||
$errors[]='File size must be excately 2 MB';
|
||||
}
|
||||
|
||||
if(empty($errors)==true){
|
||||
|
||||
$image_source = file_get_contents($file_tmp);
|
||||
$file_stream = base64_encode($image_source);
|
||||
|
||||
$data = array(
|
||||
"member_id" => $member_id ,
|
||||
"sessionid" => $session_id ,
|
||||
"uid" => $uid,
|
||||
"file_name" => $file_name,
|
||||
"file_size" => $file_size,
|
||||
"file_type" => $file_type,
|
||||
"file_data" => $file_stream,
|
||||
"title" => "WHAT EVER YOU CALL THE ITEM ".rand(100,999),
|
||||
"description" => "WHAT EVER DESCRIPTON YOU USED FOR THE ITEM ".rand(100,999)."YOUR DECRIPTIONS",
|
||||
"msg_type" => 'FILE',
|
||||
'action'=> WRENCHBOARD_RESOURCE_MYFILES
|
||||
);
|
||||
|
||||
$out = array();
|
||||
$ret = $wrenchboard->wrenchboard_api($data,$out,'uploads');
|
||||
|
||||
// "file_props" => $_FILES,
|
||||
|
||||
var_dump( $data );
|
||||
var_dump( $out );
|
||||
|
||||
move_uploaded_file($file_tmp,"images_folder/".$file_name);
|
||||
echo "Success";
|
||||
}else{
|
||||
print_r($errors);
|
||||
}
|
||||
}
|
||||
|
||||
$tt_d = date('hisjmy');
|
||||
echo highlight_string(file_get_contents(__FILE__));
|
||||
|
||||
?>
|
||||
<html>
|
||||
<body>
|
||||
|
||||
<form action="" method="POST" enctype="multipart/form-data">
|
||||
<input type="file" name="image" />
|
||||
<input type="submit"/>
|
||||
</form>
|
||||
<?=$tt_d?>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user