How to get the files from amazon s3 cloud storage - php

I am using scandir() function to scan the directory from the cloud. This function working in the local system but not worked in the sever. I have run this function using php code in the server i het the following error
Warning: scandir(https:// xxxx/yyyy/folder/): failed to open dir: No such file or directory
Warning: scandir(): (errno 2): No such file or directory
Warning: Invalid argument supplied for foreach()
How to solve this error..

You have to access the S3 Bucket for getting files from cloud server..
Refer this

Related

PHP throws a message failed to open stream

I am trying to copy file from my local machine to Windows server.
$local_dir = 'C:\Users\host\Pictures\Camera Roll'; //source url
$local_server_dir = '\\10.1.0.1\new'; //destination url the ip is
The segment that I use to copy the image is
copy("$local_dir/$files[$i]","$local_server_dir/$name")
recursively using for loop, but the system throw a warning as mention below.
Warning: copy(\10.1.0.1\new/IMG_1844.JPG): failed to open stream: No such file or directory in C:\wamp64\www\image\index.php on line 22
What can I try to investigate the cause of this?

Deploying PHP project to Openshift: failed to open stream

I have a PHP project with the following structure:
Project structure
I'm getting this an error that says:
Warning: require(../app/view/home.php): failed to open stream: No such file or directory in /opt/app-root/src/index.php on line 22
Fatal error: require(): Failed opening required '../app/view/home.php' (include_path='.:/opt/app-root/src:/opt/rh/rh-php70/root/usr/share/pear') in /opt/app-root/src/index.php on line 22
Can anyone help me to resolve this issue?
Update:
Project structure on Openshift
Thanks in advance.
I see in you image of your folder structure you have folders for public and app containing the code, but the errors from your deployment look like the code is no longer in public public but in src.. are you sure the relative links are still correctly configured?
Has index.php maybe moved to the root and the link to ../abc/xyz.php should be updated to abc/xyz.php?

PHP Warning: move_uploaded_file(myIPaddshere/uploads/code_snippet.docx): failed to open stream: No such file or directory in C:

I am trying to upload files to my website on line.I have following code that working fine for me on localhost but when i put the same on website it's giving me PHP Warning:
move_uploaded_file(myIPhere/uploads/code_snippet.docx): failed
to open stream: No such file or directory in
C:\Inetpub\vhosts\hindustantalent.com\httpdocs\reg.php\line no 61 PHP
Warning: move_uploaded_file(): Unable to move
'C:\windows\Temp\phpA6A7.tmp' to
'MyIPhere/uploads/code_snippet.docx' in
C:\Inetpub\vhosts\hindustantalent.com\httpdocs\reg.php\line no 61
I already have created a folder their namely uploads still it is giving this warning and i am unable to understand that.Can anybody help me plz

Dropbox API in Error occurs

In Dropbox api, this error occurs:
Warning: file_put_contents(dropbox/tokens/766tYP3FZu8IEv4d.token) [function.file-put-contents]: failed to open stream: No such file or directory in C:\xampp\htdocs\dropbox\dropboxupload.php on line 28
Authentication requiredhttps://www.dropbox.com/1/oauth/authorize?oauth_token=766tYP3FZu8IEv4d&oauth_callback=http%3A%2F%2Flocalhost%2Fdropbox%2Fdropboxupload.php%3Fauth_callback%3D1
How can this error be solved?
Errors are returned using standard HTTP error code syntax. Any additional info is included in the body of the return call, JSON-formatted. Error codes not listed here are in the REST API
Create folder at root name "tokens" and try again
warning is due to not having "tokens" folder in your dropbox directory at root level.
create one.
second Oauth doesnot work on a Local Machine .
try to Upload it on a server and try again .

PHP fgets() warning

I have following code:
$fh=fopen($api,"r");
$theData = fgets($fh);
echo $theData;
This throws the error as :
Warning: fopen(http://xxxxxx.xxxxxxxx.com:8080) [function.fopen]: failed to open stream: Connection refused in /home/xxxx/public_html/xxxx/index.php on line 18
Warning: fgets(): supplied argument is not a valid stream resource in /home/xxxx/public_html/xxxx/index.php on line 19
What is the solution for this?
Your file did not open as you intended. Check the value of $api and be sure the file name is in the current working directory, or the entire path to the file.
Since it is a remote system on :8080, be sure the port is open to the public. This is typically a value reserved for localhost (ie: the webserver is only a webserver to that computer, no one else's) and wouldn't be accessible to you. If the url you are opening is the same computer you are using, navigate to the file using local folders instead.

Categories