Skip to content
Advertisement

Tag: file-put-contents

PHP: Save the file returned by wget with file_put_content

I’m replacing a function that downloads a file with cURL and returns its content in a variable, then outside the function the code writes this variable to a file with file_put_content. Because of requirements of the system I have to use wget now, so I’m using something like this: But when I later use file_put_content to save the content of

Save CSV Export to Server

I have the code below which triggers when a button is pressed in the WordPress admin panel. This opens a csv file called ‘ss-stock-export.csv’. How can I save this file to my server in my uploads directory at wp-content/uploads/exports/? I tried to use file_put_contents but that doesn’t seem to be working right. The CSV file appears in the right spot

PHP: “failed to open stream: Permission denied”

I am getting some interesting results on my server when i try to access any Directory or File via some Function.I have set all my file & directory permissions to 777 and have changed the content owner to Apache but i still get error messages.Code: move_uploaded_file($_FILES[‘file’][‘tmp_name’], ‘/var/www/html/fileContent_Site/userData/’.$_SESSION[‘username’].DIRECTORY_SEPARATOR.$_FILES[‘file’][‘name’]); Or file_put_contents(‘userData/userData.txt’, $result,FILE_APPEND); mkdir(“userData/”.$register[‘username’]); For ‘move_uploaded_file()’ i get: move_uploaded_file(/var/www/php/Site/userData/radi/110729.png):failed to open stream: Permission

Advertisement