Posted by dxprog on 21:42:00 02-11-2002
How do you write files to a server?
[ This Message was edited by: dxprog on 2002-02-11 21:42 ]
Posted by fsvara on 22:12:00 02-11-2002
depends on the protocol you use - ftp? scp? i think http has some strange extensions to allow uploading, too...
Posted by dxprog on 23:06:00 02-11-2002
http would probobly be it. What's scp?
Posted by fsvara on 23:46:00 02-11-2002
secure file transfer over ssh
http is strange for uploading files, though...
Posted by KaGez on 13:30:00 02-12-2002
write files on a server? upload or what? or just open them with a php file or something and then write to them? if you're talking about the 2nd, then you can do it exactly as you could do it in C.
read:
$fp = fopen($filename, "");
$contents = fread($fp, sizeoffile($filename));
fclose($fp);
write:
$fp = fopen($filename, "a/wr/t/b/+/");
fwrite($fp, $variable);
fclose($fp);
dunno if you wanted to do this :/
[addsig]
Posted by fsvara on 14:22:00 02-12-2002
i think he wants to upload files over http...
Posted by fsvara on 14:24:00 02-12-2002
i found something about that.. don't know if that's what you want, tho:
http://www.apacheweek.com/features/put
it's about how to use PUT for upploading files with apache...
That method needs a webserver that supports it.
[ This Message was edited by: fsvara on 2002-02-12 14:25 ]
Posted by dxprog on 15:13:00 02-12-2002
Let me elaborate. I want to make a hit counter. To do this i will need to alter a file on the server.
KaGez: I don't know PHP. If you could explain that tecnique I think that may be what I want.
[addsig]
Posted by dxprog on 15:27:00 02-12-2002
I think I found what I was looking for. Thanks for the support thoough. For anyone who is interested heres the link
http://www.asplists.com/learn/test/txtwritedisplay.asp
Thanks again.
[addsig]
Posted by Peter on 17:46:00 02-12-2002
ASP .
Posted by dxprog on 18:42:00 02-12-2002
Peter: Hey you take what you can get. Any other suggestions? Besides ASP is based on VB which I understand. It's like a second language to me. If you could explain the PHP process that wuld be great.
[ This Message was edited by: dxprog on 2002-02-12 18:44 ]
Posted by dxprog on 18:59:00 02-12-2002
Just found out that GeoCities doesn't support ASP but it does support PHP 2,3, and 4. HEEELLLPPPP!!!!
[addsig]
Posted by Govtcheez on 19:03:00 02-12-2002
Try brinkster - I'm pretty sure they allow asp... Failing that, I believe 34sp does...
Posted by dxprog on 22:41:00 02-12-2002
Brinkster was OK but didn't allow writing to the server. If someone could explain the PHP method my problems would be over.
Posted by fsvara on 23:57:00 02-12-2002
what kagez posted was php code...
Posted by dxprog on 01:25:00 02-13-2002
Fsvara: I know that, but how do I implement this into the HTML file?
Posted by fsvara on 12:48:00 02-13-2002
you don't implement it in a html file, you implement it in a php file
well, if your webhost supports php, just create a .php file, put your html code inside and then use ?--> - the mean beginning and end of php code.
To output something from php to the html so that it'll show up in the browser, just use echo - "echo $contents;" in that case...
Posted by KaGez on 14:04:00 02-13-2002
bullshit, you can implent that into a HTML file too. At leats it works on my apache:
...blahblahblah....
(some HTML stuff)
. In there you can use
* code like you would use in C/C++, only that
* you have the put a "$" in front of all var names.
* The rest is almost the same as in C.
* now we end the PHP part */
?-->
...blahblahblah....
It works like this on my apache, even if I call the file .html, dunno why. But you can also call a *.html *.php, since php only executes the part between . And, as said above, if you know C you shouldn't have any probs with PHP
you can check the function reference on http://www.php.net .... it saved me lots of hours
[addsig]
Posted by ComWizz on 15:35:00 02-13-2002
I understand what you want, to achieve File I/O, you can use the Perl programming language, here are two examples:
(This will create a file)
#!/usr/bin/perl
open FILE, "-->filename-goes-here" or die "Error!\n";
print FILE "whatever-you-want\n";
print FILE "blah-blah-blah\n";
close FILE;
The above Perl code will make a file(in the directory which the script is in) called "filename-goes-here",
inside the file, it will say:
whatever-you-want
blah-blah-blah
(This is to load a file)
#!/usr/bin/perl
open FILE, "filename-to-open" or die "Error!\n";
while () {
print $_, "\n";
}
The above Perl code will load(open) a file named: "filename-to-open",
then it will show everything in the file.
If you need more help, e-mail me: comwizz@eircom.net
Posted by KaGez on 13:33:00 02-16-2002
ComWizz:
You did exactly the same thing as I did, only in Perl, and dxprog wanted to have it in PHP afaik ...
[addsig]