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

}

}

 

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.