readfile

Downloading files with PHP - Only downloading one at a time!

Hi there, I have a PHP file that serves up a file, but the problem is that no matter what browser is being used, if you click on 2 links that go to 2 separate files, the second download doesn't start until the first one is complete! Any ideas? Download Code header('Content-Type: application/octet-stream'); header('Content-Description:...

A Haskell function of type: IO String-> String

I wrote a bunch of code in Haskell to create an index of a text. The top function looks like this: index :: String -> [(String, [Integer])] index a = [...] Now I want to give this function a String read from a file: index readFile "input.txt" Which won't work because readFile is of type FilePath -> IO String. Couldn't match exp...

Calling ReadFile after DeviceIOControl yields unexpected results (Need Parallel BUSY Status).

Hi folks, I'm using "LPT1" via CreateFile for Overlapped communications. I use WaitSingleObject and then GetOverlapped Result to collect ReadFile results. All that code, including overlapped WriteFile's work great and have been for years. However, now I need to get the BUSY state of the port. It appears the only way to do this in the...

readfile not working properly

I'm trying to download a file through my server to me, by streaming the download. This is my script: header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=http://user:[email protected]/file.bin'; header('Content-Transfer-Encoding: binary'); heade...

Spaces in filename in Zend Framework action similar to readfile

I grabbed this bit of code from the PHP.net readfile page: <?php // Action controller public function someAction() { $response = $this->_response; // Disable view and layout rendering $this->_helper->viewRenderer->setNoRender(); $this->_helper->layout()->disableLayout(); // Process the file $file = 'whatever....

Saving each of this boards into a Data Structure

This is a dumb question and I feel embarrassed to ask it, but I'm pressed for time and I'm burnt out. I have this sambple input: 1 4 2 3 0 5 6 7 8 3 1 2 6 4 5 0 7 8 -1 -1 -1 each group of numbers represents a board of the 8 puzzle, I don't know how many boards will appear on the text file. I only know its end is marked with -1 -1 ...

read single line from text file in objective-C

hello, i'm new to iPhone programming and coding in XCode SDK.I want to access and read the configuration file which i have placed in Resource folder in XCode,my configuration file looks like this @key=value$ @vinu=flower$ @cathy=fruit$ I want to compare the key and access the value from configuration file. Since i'm working with iPho...

Changing CRC of a file through readfile()

I have this code set up that lets a user download a file through my server from a URL they specify. The file streams through using readfile() so it only uses my bandwidth. <?php set_time_limit(0); $urlParts = explode("/", $_SERVER['PHP_SELF']); $file = $urlParts[3]; header("Cache-Control: public, must-revalidate"); header("Pragma: ha...

Haskell readFile type problem

Hi, I have some troubles with Haskell type system. Situation: Following program is taking list of filenames on the cmdline For all filename it reads its content using the function readFile Content of each file is passed to inputParser (Parsec) Rest is not so important Main problem is in function read_modules First two statements of th...

What's the correct way to use win32file.ReadFile to get the output from a pipe?

I'm using the pywin32 extensions to access the win32 API under Python. I'm new at doing Windows programming in Python -- I'm a POSIX guy -- so I may be doing things in a bone-headed manner. I'm trying to use the win32file.ReadFile function properly, and I'm having some trouble interpreting the possible result codes. I'm calling the fun...

PHP readfile or file_get_contents in a loop

there may be other ways to do this but I'm looking for an fairly easy set-up because it's basically a one-time process. I have 50 state directories with a handful of txt files in each one. I want to step into each directory, "read" each file (and then do a mysql insert of each file) I've tried a few variations, but each time I try to ...

Open file in ML(SMLNJ)

I need to read file in ML (SLMNJ) and save it in some structures. I need to read some data that points to graph declaration: [( 1 , 2 , 13 ),( 2 , 3 , 3 ),( 2 , 4 , 8 ),( 2 , 5 , 4 ),( 3 , 1 , 5 ),( 3 , 4 , 1 ),( 4 , 6 , 5 ),( 5 , 5 , 5 ),( 6 , 4 , 6 )] (first number: name of the node , secend number: name of connected node , third n...

read a line in Objective-C

Hello, i've to read a .txt file , The file lokes like, WIPRO=Class_Name1 TCS=Class_Name2 Now i want to Class_Name1 and Class_Name2.How to get this string in Objective-C? I'm not finding any function in NSString to get the index of a character.Like how we have getIndex() in C#.tel me how to proceed. ...

How to read file from phone's internal memory in android?

I have downloaded a file from HttpConnection using the FileOutputStream in android and now its being written in phone's internal memory on path as i found it in File Explorer /data/data/com.example.packagename/files/123.ics Now, I want to open & read the file content from phone's internal memory to UI. I tried to do it by using the Fil...

read textfile with delimiter in php

I have three eintries in a textfile.txt: 20100220 Hello Here is Text \n blah \t even | and & and so on... I want to read each entrie (line) as a new string in php. I thought of using fopen and fgets. But: Since I'm using special characters like \n in the last line, fgets() would not work because it will terminate the string at \n, rig...

ReadFile, COM and NULL characters in c++

I have a problem with ReadFile function in a virtual serial port: char tmp[128]; int multiplo=0; DWORD err; COMSTAT stt; ClearCommError(hcom, &err, &stt); do{ if(ReadFile(hcom, tmp, stt.cbInQue, &err, NULL)){ tmp[err] = '\0'; memcpy(bfIn+multiplo, tmp, err); multiplo = multiplo + err; }else retur...

PHP Streaming MP3

I have a very similar situation to the person who asked: http://stackoverflow.com/questions/1516661/can-i-serve-mp3-files-with-php Basically I am trying to protect mp3 files from direct download, so users have to go through php to get authenticated first. Here's my code: header('Content-type: audio/mpeg'); header('Content-length: ' . fi...

According to MSDN ReadFile() Win32 function may incorrectly report read operation completion. When?

The MSDN states in its description of ReadFile() function: If hFile is opened with FILE_FLAG_OVERLAPPED, the lpOverlapped parameter must point to a valid and unique OVERLAPPED structure, otherwise the function can incorrectly report that the read operation is complete. I have some applications that are violating the above recommend...

how can i redirect page while download box appears?

Now I got this code; <?php $file = "pain.png"; if (file_exists($file)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.basename($file)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header...

PHP readfile for force downloading files and images

I want to send files through php using readfile() What i've noticed is that readfile forces a download, but what if i want to show an image in the browser and not force a download? Would readfile still force download even if the file is an image? If it does, is there a solution so i can use tags with it when the file is an image? Th...