// Continue only if the file was uploaded via HTTP POST if (is_uploaded_file($_FILES['image']['tmp_name'])) { // Is file size less than 1 MB = 1,048,576 Byte if ($_FILES['image']['size'] < 1048576) { // Detect MIME Content-type for a file if (function_exists('mime_content_type')) { $mime = mime_content_type($_FILES['image']['tmp_name']); } else { $mime = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $_FILES['image']['tmp_name']); } // List of accepted MIME Content-type $images = array('image/jpeg', 'image/gif', 'image/png', 'image/svg+xml'); if (in_array($mime, $images)) { // PHP5 is not capable of addressing files with multi-byte characters in their names at all. // This is why we use Transliteration functionality in Arabic class $filename = trim($Arabic->ar2en($_FILES['image']['name'])); // Moves an uploaded file to a new location // move_uploaded_file ($_FILES['image']['tmp_name'], $dir.DIRECTORY_SEPARATOR.$filename); echo "move_uploaded_file(\$_FILES['image']['tmp_name'], \$dir.DIRECTORY_SEPARATOR.\"{$filename}\");"; } else { echo '<h3>You can upload image file only (i.e. gif, jpg, png, and svg)!</h3>'; } } else { echo '<h3>You can not upload file bigger than 1MB!</h3>'; } } else { echo '<h3>You have to select file first to upload it!</h3>'; } } ?> <br /><br />
function ar2en($text) { $obj = new I18N_Arabic('Transliteration'); return $obj->ar2en($text); }
English<br />(auto generated) </font> </b> </td> <td bgcolor="#27509D" align="center" width="150"> <b> <font color="#ffffff"> Arabic<br />(sample input) </font> </b> </td> </tr> END; foreach ($ar_terms as $term) { echo '<tr><td bgcolor="#f5f5f5" align="left"><font face="Tahoma">'; echo $Arabic->ar2en($term); echo '</font></td>'; echo '<td bgcolor="#f5f5f5" align="right">' . $term . '</td></tr>'; } echo '<tr><td bgcolor="#d0d0f5" align="left"><font face="Tahoma">'; echo $Arabic->enNum('0123,456.789'); echo '</font></td>'; echo '<td bgcolor="#d0d0f5" align="right">0123,456.789</td></tr>'; echo '</table></center>'; ?> </div><br /> <div class="Paragraph"> <h2>Example Code:</h2> <?php $code = <<<ENDALL <?php