/    Sign up×
Community /Pin to ProfileBookmark

unable to locate file into temp directory

Friend..Need help.

i use php 4.0.5 and apache1.3 in windows xp.

i store picture files in database mysql.for the viewing purpose, i echo the file content as link.When i click the link.I get a save as message box.I can save the file in my local computer and view file fine but when i click the open button in “save as message box” , i unable open the file successfully.

The error message :

the path or file name c:document and settingstestlocal settingsTemporary Internet filescontent.IE5k9mzderamodule4[1].ppt is invalid.please check the path and file name correct.

In my php.ini i declare the upload_tmp_dir =”C:/apache/php/uploadtemp/” ;

page1.php

<? echo “&nbsp;&nbsp;&nbsp; “. “<a href=”slide-view.php?id1=$id1″> $name[/url]”; ?> –> if i click the link, the download message box appear and when i click open i get error as above.

slide-view.php
<?php

session_start();

mysql_connect(“localhost”, “root”, “root”) or die(“no connection”);
mysql_select_db(“gddatab”) or die(“no database”);
if(isset($HTTP_GET_VARS[‘id1’]))
{

$id = $HTTP_GET_VARS[‘id1’];
$query = “SELECT cs_name, cs_type, cs_size, cs_content FROM ots_slide WHERE cs_id = ‘$id'”;

$result = mysql_query($query) or die(‘Error, query failed’);
list($name, $type, $size, $content) = mysql_fetch_array($result);

header(“Content-length: $size”);
header(“Content-type: $type”);
header(“Content-Disposition: attachment; filename=$name”);
echo $content;
exit;
}

?>

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@WebnerdOct 09.2007 — Add this here:

<i>
</i>
session_cache_limiter('');

header('Expires:'.gmdate('D, d M Y H:i:s',time()+(60*5)) . ' GMT');

header("Content-length: $size");



PHP defaults it's headers to no-cache and IE requires caching for files such as PDFs, PPTs and other binary files
×

Success!

Help @inspire spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...