header image/jpeg
Excuseren mijn schrijftaal matig maar probeer ik vertellen.
Ik heb probleem met header image/jpeg en gebruik ik joomla met eigen extensie opbouwen. waar ze te vinden in images/phocagallery/test/test2e/23-celica.jpg
wat ik heb verbouwen met header image/jpeg om te kunnen download.
hij download prima en 1mb dat wel klopt maar alleen kan niet afbeelding weer te geven zou lijkt mij verkeerde php code tot nu is niet mij lukt en zal ik laten zien of heb ik verkeerde php code ingevoerd.
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<style>
div.container {
width: 790px;
}
div.spacer {
clear: both;
}
#whatimg{
float: left;
margin: 10px;
}
</style>
<script>
function valButton(btn) {
var cnt = -1;
for (var i=btn.length-1; i > -1; i--) {
if (btn[i].checked) {cnt = i; i = -1;}
}
if (cnt > -1) return btn[cnt].value;
else return null;
}
</script>
<div class="container">
<div class="spacer">
<h1>Verzameld</h1>
div.container {
width: 790px;
}
div.spacer {
clear: both;
}
#whatimg{
float: left;
margin: 10px;
}
</style>
<script>
function valButton(btn) {
var cnt = -1;
for (var i=btn.length-1; i > -1; i--) {
if (btn[i].checked) {cnt = i; i = -1;}
}
if (cnt > -1) return btn[cnt].value;
else return null;
}
</script>
<div class="container">
<div class="spacer">
<h1>Verzameld</h1>
Quote:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
$k = 0;
for ($i=0, $n=count( $this->uitgave ); $i < $n; $i++) {
$row = &$this->uitgave[$i];
$link = JRoute::_( '/~heer/images/phocagallery/');
echo '<form method="post" action="index.php?option=com_phocagallery&view=detail&layout=default_verzamel&catid='.$this->item->catslug.'&id='.$this->item->slug.'&tmpl=component'.'">';
echo "<div id='whatimg'> <img width='85' height='60' src='" . $link, $row->filename . "' /> ";
echo "<p> <input type='radio' id='".$row->filename."' name='option_choice' value='".$row->filename."'".(($row->filename == $_POST['option_choice'])?'checked="checked"':'').'/> </div></p>';
$k = 0 - $k;
}
echo '<input type="submit" value="Download" />';
echo '</form>';
$processing_message = $_POST['option_choice'];
if (strlen($processing_message) > 0) {
// echo '<div class="processing_message">/images/phocagallery/'.$processing_message.'</div>';
}
if($processing_message = $_POST['option_choice']){
$downloadmap = "http://" . $_SERVER['SERVER_ADDR'] . "/~heer/images/phocagallery/";
$filename = $downloadmap . $processing_message;
// echo 'hello';
// echo $filename;
$file_extension = strtolower(substr(strrchr($filename,"."),1));
// echo $file_extension;
switch ($file_extension) {
case "pdf": $ctype="application/pdf"; break;
case "exe": $ctype="application/octet-stream"; break;
case "zip": $ctype="application/zip"; break;
case "doc": $ctype="application/msword"; break;
case "xls": $ctype="application/vnd.ms-excel"; break;
case "ppt": $ctype="application/vnd.ms-powerpoint"; break;
case "gif": $ctype="image/gif"; break;
case "png": $ctype="image/png"; break;
case "jpe": $ctype="image/jpe"; break;
case "jpeg": $ctype="image/jpg"; break;
case "jpg": $ctype="image/jpg"; break;
default: $ctype="application/force-download";
}
// if (!file_exists($filename)) {
// die("NO FILE HERE".$filename);
// }
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: $ctype");
header('Content-Disposition: attachment; filename="'.basename('untitled.bmp').'"');
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".@filesize($filename));
set_time_limit(0);
@readfile("$filename") or die("File not found.");
exit;
}
echo '<div id="phocaGallerySlideshowC" style="display:none"></div>';
?>
$k = 0;
for ($i=0, $n=count( $this->uitgave ); $i < $n; $i++) {
$row = &$this->uitgave[$i];
$link = JRoute::_( '/~heer/images/phocagallery/');
echo '<form method="post" action="index.php?option=com_phocagallery&view=detail&layout=default_verzamel&catid='.$this->item->catslug.'&id='.$this->item->slug.'&tmpl=component'.'">';
echo "<div id='whatimg'> <img width='85' height='60' src='" . $link, $row->filename . "' /> ";
echo "<p> <input type='radio' id='".$row->filename."' name='option_choice' value='".$row->filename."'".(($row->filename == $_POST['option_choice'])?'checked="checked"':'').'/> </div></p>';
$k = 0 - $k;
}
echo '<input type="submit" value="Download" />';
echo '</form>';
$processing_message = $_POST['option_choice'];
if (strlen($processing_message) > 0) {
// echo '<div class="processing_message">/images/phocagallery/'.$processing_message.'</div>';
}
if($processing_message = $_POST['option_choice']){
$downloadmap = "http://" . $_SERVER['SERVER_ADDR'] . "/~heer/images/phocagallery/";
$filename = $downloadmap . $processing_message;
// echo 'hello';
// echo $filename;
$file_extension = strtolower(substr(strrchr($filename,"."),1));
// echo $file_extension;
switch ($file_extension) {
case "pdf": $ctype="application/pdf"; break;
case "exe": $ctype="application/octet-stream"; break;
case "zip": $ctype="application/zip"; break;
case "doc": $ctype="application/msword"; break;
case "xls": $ctype="application/vnd.ms-excel"; break;
case "ppt": $ctype="application/vnd.ms-powerpoint"; break;
case "gif": $ctype="image/gif"; break;
case "png": $ctype="image/png"; break;
case "jpe": $ctype="image/jpe"; break;
case "jpeg": $ctype="image/jpg"; break;
case "jpg": $ctype="image/jpg"; break;
default: $ctype="application/force-download";
}
// if (!file_exists($filename)) {
// die("NO FILE HERE".$filename);
// }
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: $ctype");
header('Content-Disposition: attachment; filename="'.basename('untitled.bmp').'"');
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".@filesize($filename));
set_time_limit(0);
@readfile("$filename") or die("File not found.");
exit;
}
echo '<div id="phocaGallerySlideshowC" style="display:none"></div>';
?>
</div>
</div>
Link werkt
Download werkt
Afbeelding weergeven werkt niet
Alvast bedankt.
Gewijzigd op 06/09/2011 13:52:36 door Sebastiaan vd laan
even je script tussen [code] en [/code] tags doen aub
Gewijzigd op 06/09/2011 13:54:03 door Sebastiaan vd laan
Exit op regel 57 weg halen?
Verder is dubbele quotes om de variabele $filename natuurlijk zeer overbodig:
Is beter.
Ik heb probleem gevonden
http://adressen/~name/test/test2/test3/test.php HIJ WERKT
Quote:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
$filename = '../../../23-celica.jpg';
if(ini_get('zlib.output_compression'))
ini_set('zlib.output_compression', 'Off');
$file_extension = strtolower(substr(strrchr($filename,"."),1));
switch( $file_extension )
{
case "pdf": $ctype="application/pdf"; break;
case "exe": $ctype="application/octet-stream"; break;
case "zip": $ctype="application/zip"; break;
case "doc": $ctype="application/msword"; break;
case "xls": $ctype="application/vnd.ms-excel"; break;
case "ppt": $ctype="application/vnd.ms-powerpoint"; break;
case "gif": $ctype="image/gif"; break;
case "png": $ctype="image/png"; break;
case "jpeg":
case "jpg": $ctype="image/jpg"; break;
default: $ctype="application/force-download";
}
header("Pragma: public"); // required
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false); // required for certain browsers
header("Content-Type: $ctype");
// change, added quotes to allow spaces in filenames, by Rajkumar Singh
header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" );
header("Content-Transfer-Encoding: binary");
readfile($filename);
exit();
?>
$filename = '../../../23-celica.jpg';
if(ini_get('zlib.output_compression'))
ini_set('zlib.output_compression', 'Off');
$file_extension = strtolower(substr(strrchr($filename,"."),1));
switch( $file_extension )
{
case "pdf": $ctype="application/pdf"; break;
case "exe": $ctype="application/octet-stream"; break;
case "zip": $ctype="application/zip"; break;
case "doc": $ctype="application/msword"; break;
case "xls": $ctype="application/vnd.ms-excel"; break;
case "ppt": $ctype="application/vnd.ms-powerpoint"; break;
case "gif": $ctype="image/gif"; break;
case "png": $ctype="image/png"; break;
case "jpeg":
case "jpg": $ctype="image/jpg"; break;
default: $ctype="application/force-download";
}
header("Pragma: public"); // required
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false); // required for certain browsers
header("Content-Type: $ctype");
// change, added quotes to allow spaces in filenames, by Rajkumar Singh
header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" );
header("Content-Transfer-Encoding: binary");
readfile($filename);
exit();
?>
http://adressen/~name/index.php/test/5-test2e/detail/74-23-celica?layout=default_verzamel WERKT NIET :(
Quote:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
$k = 0;
for ($i=0, $n=count( $this->uitgave ); $i < $n; $i++) {
$row = &$this->uitgave[$i];
$link = JRoute::_( '/~heer/images/phocagallery/');
echo '<form method="post" action="index.php?option=com_phocagallery&view=detail&layout=default_verzamel&catid='.$this->item->catslug.'&id='.$this->item->slug.'&tmpl=component'.'">';
echo "<div id='whatimg'> <img width='85' height='60' src='" . $link, $row->filename . "' /> ";
echo "<p> <input type='radio' id='".$row->filename."' name='option_choice' value='".$row->filename."'".(($row->filename == $_POST['option_choice'])?'checked="checked"':'').'/> </div></p>';
$k = 0 - $k;
}
echo '<input type="submit" value="Download" />';
echo '</form>';
//if($processing_message = $_POST['option_choice']){
//$downloadmap = "../../../../../images/phocagallery/";
//$filename = $downloadmap . $processing_message;
$filename = '../../../../../../23-celica.jpg';
// (ook geprobeerd)
$filename = '23-celica.jpg';
echo "<br><br><br><br><br>" . $filename;
if(ini_get('zlib.output_compression'))
ini_set('zlib.output_compression', 'Off');
$file_extension = strtolower(substr(strrchr($filename,"."),1));
switch( $file_extension )
{
case "pdf": $ctype="application/pdf"; break;
case "exe": $ctype="application/octet-stream"; break;
case "zip": $ctype="application/zip"; break;
case "doc": $ctype="application/msword"; break;
case "xls": $ctype="application/vnd.ms-excel"; break;
case "ppt": $ctype="application/vnd.ms-powerpoint"; break;
case "gif": $ctype="image/gif"; break;
case "png": $ctype="image/png"; break;
case "jpeg":
case "jpg": $ctype="image/jpg"; break;
default: $ctype="application/force-download";
}
header("Pragma: public"); // required
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false); // required for certain browsers
header("Content-Type: $ctype");
// change, added quotes to allow spaces in filenames, by Rajkumar Singh
header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" );
header("Content-Transfer-Encoding: binary");
readfile($filename);
exit();
echo '<div id="phocaGallerySlideshowC" style="display:none"></div>';
?>
$k = 0;
for ($i=0, $n=count( $this->uitgave ); $i < $n; $i++) {
$row = &$this->uitgave[$i];
$link = JRoute::_( '/~heer/images/phocagallery/');
echo '<form method="post" action="index.php?option=com_phocagallery&view=detail&layout=default_verzamel&catid='.$this->item->catslug.'&id='.$this->item->slug.'&tmpl=component'.'">';
echo "<div id='whatimg'> <img width='85' height='60' src='" . $link, $row->filename . "' /> ";
echo "<p> <input type='radio' id='".$row->filename."' name='option_choice' value='".$row->filename."'".(($row->filename == $_POST['option_choice'])?'checked="checked"':'').'/> </div></p>';
$k = 0 - $k;
}
echo '<input type="submit" value="Download" />';
echo '</form>';
//if($processing_message = $_POST['option_choice']){
//$downloadmap = "../../../../../images/phocagallery/";
//$filename = $downloadmap . $processing_message;
$filename = '../../../../../../23-celica.jpg';
// (ook geprobeerd)
$filename = '23-celica.jpg';
echo "<br><br><br><br><br>" . $filename;
if(ini_get('zlib.output_compression'))
ini_set('zlib.output_compression', 'Off');
$file_extension = strtolower(substr(strrchr($filename,"."),1));
switch( $file_extension )
{
case "pdf": $ctype="application/pdf"; break;
case "exe": $ctype="application/octet-stream"; break;
case "zip": $ctype="application/zip"; break;
case "doc": $ctype="application/msword"; break;
case "xls": $ctype="application/vnd.ms-excel"; break;
case "ppt": $ctype="application/vnd.ms-powerpoint"; break;
case "gif": $ctype="image/gif"; break;
case "png": $ctype="image/png"; break;
case "jpeg":
case "jpg": $ctype="image/jpg"; break;
default: $ctype="application/force-download";
}
header("Pragma: public"); // required
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false); // required for certain browsers
header("Content-Type: $ctype");
// change, added quotes to allow spaces in filenames, by Rajkumar Singh
header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" );
header("Content-Transfer-Encoding: binary");
readfile($filename);
exit();
echo '<div id="phocaGallerySlideshowC" style="display:none"></div>';
?>
ik hoop dat kan oplossing en ik heb file exists met functie geprobeerd blijkt werkt ook niet.
Gewijzigd op 07/09/2011 12:19:07 door Sebastiaan vd laan