Why do I keep getting an error saying "291Couldn't find file #4.txt "?
I am working on a project to test if I can use SWFTools on my site. I have created this script to just display scrolling text on the screen of the user's choice.
开发者_高级运维All the information you need to know is below:
Additional Info that might help you: PHP info version info: PHP 5.2.12 (cli) (built: Dec 16 2009 17:03:10) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
Server: XAMPP (apache, php, mysql, plus some others) on Microsoft Windows 7
SwfTools file: swfc.exe
SwfTools version: 0.9.0
My Project is made up of 2 php files: index.php makefile.php
Project Available at: http://ericlounge.host22.com/000/22014/allfiles.zip
error: "291Couldn't find file #4.txt"
file: /ProjectDirectory/index.php?filename=Test&text=Test+inverted+blend+mode...+ABCDEFGHIJKLMNOPQRSTUVWXYZ&image=1&makeswf=true
SwfTools SWFC documentation: http:// www.swftools.org/swfc/swfc.html
IMO it happens here
else
{
require("makefile.php");
$file = $_GET["filename"];
$text = $_GET["text"];
$img = $_GET["image"];
$file = fopen($file . ".txt","w");
echo fwrite($file, createswffile($file, $img, $text));
fclose($file);
system("swfc " . $file . ".txt");
You are trying to open file which doesn't exist. I believe your $file contains 4 as the filename, which later on is used to open file.
Try echo-ing the value of $file, and you'll see that its 4.
Again, I just put skimmed through your code, without diving into details.
I found the answer.
I was using the variable "$file" twice. I set it here:
$file = $_GET["filename"]; and here
$file = fopen($file . ".txt","w");
It was using the file from fopen because that was called last. In the end, it opened up a completely wrong file.
精彩评论