Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'm making a file creating script in php using file_put_contents, so how do you place a file to the directory below?
For example the script is in localhost:8080/favicon/ and I want to place the file in localhost:8080, how can this be done?
$dest = __DIR__ . '/../filename';
file_put_contents($dest, $data);
See http://php.net/manual/language.constants.predefined.php
fclose(fopen(path_to_your_file_like_C:\abc\,"a"));
for more info go here.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I'm working on a sitemap script but now I need to know how I can scan all my photo's since they are in different folders (I'm working with albums)
All my images that I want to get into the sitemap are in this directory: public_html/Albums/{Albumname}/{photo name}
How can I do this?
If the location in not remote then you can try the following:
<?php
$path = realpath('public_html/Albums');
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $filename)
{
echo "$filename\n";
}
?>
You can generate the URL accordingly in the loop.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How can I parse this txt file or how could i turn it into xml(if it's possible)?
Help please.
Edit: Yes, that is not a json.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Why when it displays does it say Resource id #2?
All I am doing is fetching a simple number (0) out of a .txt file:
$num = fopen('qnum/qnum.txt', 'r');
echo $num;
You are not actually reading the file. You are only opening it and acquiring a reference to the file. You have to add more code (e.g. something along the lines of the answers to this question) to read the contents of the file.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How can I save "example.mp4" from $url="http://videos.com/example.mp4" as "56.mp4" using a variable $id=56 to /videos
mkdir('/videos');
file_put_contents("/videos/" . ((string) $id) . ".mp4", file_get_contents($url));
Documentation:
http://php.net/manual/en/function.file-get-contents.php
http://php.net/manual/en/function.file-put-contents.php
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
It's a blank page and that's not how it's supposed to be :/
Can anyone help me out with this?
Code - http://pastie.org/private/9klk5tm6goixq4ev93tkq
-
Mord
You need closing parenthesis on every line that has one opening.
Example:
move_uploaded_file($_FILES["thematicseniorphoto"]["tmp_name"], "uploads/" . $_FILES["thematicseniorphoto"]["tmp_name"];
should be
move_uploaded_file($_FILES["thematicseniorphoto"]["tmp_name"], "uploads/" . $_FILES["thematicseniorphoto"]["tmp_name"]);
EDIT:
Next time use a while() statement and find a pattern of text to search/use. You'll go from 700 lines to like...20.