Jump to content

open file as per its format on website


vikaspa

Recommended Posts

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

<?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]);

}

}

 

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.