473,326 Members | 2,134 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Problem in reading a file from database

Hi guys, i have a php file to read to content, the following is the code
[PHP]
<?php
include "config.inc.php";
include "connect.inc.php";

if(isset($_GET['id']))
{
$id = $_GET['id'];
$query = "SELECT filename, filetype, filesize, content FROM candidate_table where id = '$id'";
$result = mysql_query($query) or die(mysql_error());

list($filename, $type, $size, $content) = mysql_fetch_array($result);
$file = fopen($filename,"r") or exit("unable to open");
echo "<div style=\"border:1px blue solid; \">";
while(!feof($file))
{
echo fgets($file);
}
fclose($file);
echo "</div>";
/*
header("Content-length:$size");
header("Content-type:$type");
header("Content-Disposition:attachment; $filename=$name");
echo $content;*/
exit;
}

?>
[/PHP]
but, when run the scripts, it showing the following error,

[HTML]
Warning: fopen(drgulrez[02,00][2].doc) [function.fopen]: failed to open stream: No such file or directory in C:\wamp\www\dr_resume_databse\cv.php on line 12
unable to open
[/HTML]
i m not able to fine the solution, if any one can help, plz help me thanks
Nov 23 '07 #1
4 1406
coffear
20
presumably drgulrez[02,00][2].doc is actually a file? Also it might be best using a server path to the file in fopen as well.
Nov 23 '07 #2
Yes, this is the file, when i run other php file to download the same file its working properly, but when i try to open the same file its giving the warning that i posted earlier. and how to used server path...i dont have idea for that plz help...

presumably drgulrez[02,00][2].doc is actually a file? Also it might be best using a server path to the file in fopen as well.
Nov 23 '07 #3
on the line after your list() function call you could manip your filename variable to have the path included.. ie:

$filename = "C:\wamp\www\dr_resume_databse\" . $filename;
Nov 23 '07 #4
Thanks.. for the reply.. . i got the solution.. and thanks for guiding me ...
on the line after your list() function call you could manip your filename variable to have the path included.. ie:

$filename = "C:\wamp\www\dr_resume_databse\" . $filename;
Nov 24 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: NohaKhalifa | last post by:
Dear All; I'm developing a web site and i need to make adminisration for this site it's a site for Real Estates . But I don't need the administration to be online .. I want them to fill data...
7
by: Graham Taylor | last post by:
I've tried posting this in the 'microsoft.public.access' but I will post it here also, as I think it might be the webserver which is causing my problem. --------- I have an Access 2003 database...
3
by: David Blasdell | last post by:
This appears very strange to me, I'm having a problem with a fstream object inside a class which is not being called directly from main (another class calls the class that contains the fstream...
2
by: Sabin Finateanu | last post by:
Hi I'm having problem reading a file from my program and I think it's from a procedure I'm using but I don't see where I'm going wrong. Here is the code: public bool AllowUsage() { ...
7
by: jsale | last post by:
I'm currently using ASP.NET with VS2003 and SQL Server 2003. The ASP.NET app i have made is running on IIS v6 and consists of a number of pages that allow the user to read information from the...
1
by: needin4mation | last post by:
Hi, I am uploading a file and changing a record in a database. When the database is updated, I retrieve the last_insert_id() to get the latest row key. I also have a Page_Load event that...
10
by: tvin | last post by:
Hi all I brought a string from a .txt file which was saved like utf-8. In the .txt file i have this string "frédéric".My problem is that when i read this file .txt,the bytes of é are like...
9
by: HC | last post by:
Hello, all, I started out thinking my problems were elsewhere but as I have worked through this I have isolated my problem, currently, as a difference between MSDE and SQL Express 2005 (I'll just...
0
by: nrip | last post by:
Dear All, I am facing a very peculiar problem. I am reading a CSV file from my JSP code and trying to insert them into MYSQL database. the program first reads a line and then splits it into words...
2
by: Derik | last post by:
I've got a XML file I read using a file_get_contents and turn into a simpleXML node every time index.php loads. I suspect this is causing a noticeable lag in my page-execution time. (Or the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.