vikaspa Posted March 31, 2008 Share Posted March 31, 2008 I had made provision to upload file in jpg, excel, pdf or word format The file is uploaded on server. It was assumed that the file uploaded will be in jpg format and I can display the file in jpg, png, gif format So to display file in pdf, word or excel Now i need to check the file format and display it according (as per file format ) Please please help me to display the uploaded file in different format I will be really greatful .... Thanks in advance Link to comment https://forums.phpfreaks.com/topic/98769-open-file-as-per-its-format-on-website/ Share on other sites More sharing options...
getshahidonline Posted March 31, 2008 Share Posted March 31, 2008 <?php $image_jpg = array(); $image_png = array(); $image_gif = array(); $myimage = array('first.jpg','second.png','third.gif','fourth.jpg','fifth.png','sixth.gif'); for($i=0; $i<6; $i++) { $ext = substr($myimage[$i],-3); if($ext == 'jpg') { array_push($image_jpg ,$myimage[$i]); } elseif($ext == 'png') { array_push($image_png ,$myimage[$i]); } else { array_push($image_gif ,$myimage[$i]); } } ?> Link to comment https://forums.phpfreaks.com/topic/98769-open-file-as-per-its-format-on-website/#findComment-505437 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.