Skip to content

Instantly share code, notes, and snippets.

View abidra's full-sized avatar
:shipit:
Hello

Abid Ra abidra

:shipit:
Hello
View GitHub Profile
@abidra
abidra / mime.Class.php
Last active September 27, 2017 14:11
Class PHP to define what categories of the file based on Mime Type
<?php
$music_mime_types = array(
'audio/basic',
'auido/L24',
'audio/mid',
'audio/mp4',
'audio/x-aiff',
'audio/x-mpegurl',
'audio/vnd.rn-realaudio',
'audio/ogg',
@abidra
abidra / receiver.php
Created March 17, 2017 13:35
Receiver file form upload file to external server using PHP cURL
<?php
if(isset($_POST['file'])){
$encoded_file = $_POST['file'];
$file = base64_decode($encoded_file);
$title = $_POST['file']['name'];
file_put_contents($title, $file);
}
?>
@abidra
abidra / form.php
Created March 17, 2017 13:19
Form to upload file using PHP
<form enctype="multipart/form-data" encoding='multipart/form-data' method='post' action="form.php">
<input name="upload_file" type="file" value="choose">
<input type="submit" value="Upload">
</form>
<?
if ( isset($_FILES['upload_file']) ) {
$filename = $_FILES['upload_file']['tmp_name'];
$handle = fopen($filename, "r");
$data = fread($handle, filesize($filename));
$POST_DATA = array(