I have created a page from where users can upload their files. This code snippet send those files to my Amazon S3 bucket.
<form action="https://BUCKET.s3-eu-west-1.amazonaws.com/" method="post" enctype="multipart/form-data">
<input type="hidden" name="awsAccessKey" value="ACCESS_KEY">
<input type="hidden" name="awsSecretKey" value="SECRET_KEY">
<input type="hidden" name="acl" value="private">
<input type="hidden" name="policy" value="POLICY">
<input type="hidden" name="signature" value="SIGNATURE">
<input type="hidden" name="Content-Type" value="">
<!-- Include any additional input fields here -->
File to upload to S3:
<input name="file" type="file">
<br>
<input type="submit" value="Upload File to S3">
</form>
Everything works fine, but I am facing https problems. Main browsers don't trust s3-eu-west-1.amazonaws.com and show security message about untrusted connection.
I changed my the HTTPS connection to HTTP so that my customers don't face any problem. Does someone have any ideas on how to resolve this issue?
Chances are your bucket name has a dot in it. Amazon's S3 wildcard certificates are good for only one level of subdomains, so bucket.s3-eu-west-1.amazonaws.com is fine but bucket.bucket.s3-eu-west-1.amazonaws.com is not. Use this instead:
https://s3-eu-west-1.amazonaws.com/BUCKET/
Related
First off, I have no experience with PHP. I'm setting up a form on a site that is hosted on Dotster using their link. This works to send an email with all of the info, but the file that is selected for upload disappears. Does not end up on the server, does not attach to the email. Are there any ways to determine or control where the file goes using their script?
<form method="post" action="https://www1.dotster.com/scripts/formemail.html" enctype="multipart/form-data">
<input type="hidden" name="my_email" value="flyboyjr#gmail.com">
<input type="hidden" name="subject" value="Nomination Form">
<h1>Nominee Information</h1>
<label for="photo">Please upload a photo of the nominee in uniform or sports attire appropriate with
their
nomination. Please make sure it includes a clear view of their face.</label><br><br>
<input type="file" id="photo" name="photo" required>
I am trying to make a Telegram Bot and it needs to upload a certificate file to it's server (see enter link description here).
The target url is something like this:
"https://api.telegram.org/bot/setWebhook?url=somewhere/on/the.web&certificate='certFile.cer'"
I need to specify two parameters within a php file.
1- the url
2- the file which should be upload.
now as I am new in php I don't know how to send file as a parameter.
I tried to do it by a html form like this:
<form action="https://api.telegram.org/bot########:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/setWebhook" method="post" enctype="multipart/form-data">
<input type="url" name="url" value="https://XXXXX.com/send.php"/><br/>
<input type="file" name="certificate" /><br/>
<input type="submit" name="btn" /><br/>
</form>
But it doesn't work.
Any advice will be appreciated.
If there is a website and I want to write a form that logs me in, how can I do it?
This form logs me to stack overflow
<form method="post" action="https://stackoverflow.com/users/login">
<input type="hidden" name="email" value="myemail">
<input type="hidden" name="password" value="mypassword">
<input type="submit">
</form>
I want to do so on this website, but the script doesn't work for some reason.
<form method="post" action="http://forums.heroesofnewerth.com/login.php?do=login/">
<input type="hidden" name="vb_login_username" value="myusr">
<input type="hidden" name="vb_login_password" value="mypass">
<input type="submit">
</form>
Any idea why?
Ok, it worked I had to send more data.
<form method="post" action="http://forums.heroesofnewerth.com/login.php" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)">
<input type="hidden" name="vb_login_username" value="usr">
<input type="hidden" name="vb_login_password" value="pwd">
<input type="hidden" name="do" value="login">
<input type="hidden" name="vb_login_md5password" value="">
<input type="hidden" name="vb_login_md5password_utf" value="">
<input type="hidden" name="s" value="">
<input type="hidden" name="securitytoken" value="guest">
<input type="hidden" name="url" value="http://forums.heroesofnewerth.com/index.php">
<input type="submit">
</form>
A lot of websites on the internet (not nearly enough though) have protection in place that prevents sites other then their own to post forms (log in for example) to their site. A site that does not have this protection is vulnerable to:
Cross Site Request Forgery (CSRF): http://en.wikipedia.org/wiki/Cross-site_request_forgery
This is a major security risk that allows phishing sites to log you in to the actual website while catching your login details and a whole lot of other nasty stuff.
There could also be other protection in place to prevent you from sending a request.
Try to see if there are any API's available instead for what you are trying to achieve.
I have a very basic PHP multiple file upload form:
<form action="file.upload.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="id" value="<?php echo $_REQUEST['id']; ?>" />
<input type="hidden" name="bypass" value="1" />
<input multiple type="file" name="file[]" id="file">
<input type="submit" name="submit" value="Submit">
</form>
Everything works fine for a few files, but when I upload too many large files, the hidden variables are no longer posted to PHP (!)
I am not sure what is causing the from variables to be ignored by PHP (?)
(I've checked with fiddler and the form indeed sends the right data from clientside... i.e., form fields bypass and id are both properly populated on clientside...)
The PHP documentation doesn't explain what happens when there are two files being uploaded at the same time within the same session (two uploads running in two tabs of a browser).
Is there any way to track the progress of both uploads?
Is the first upload status lost when the second one starts?
Thanks!
Yes, it is possible to monitor the status on two different uploads in different tabs using PHP's Session Upload Progress feature. All you need to do is make the upload progress name different on both forms by changing the value="" parameter of the hidden upload progress name field.
For example, the upload form for tab 1 could look as follows:
<form action="upload.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="<?php echo ini_get("session.upload_progress.name"); ?>" value="tab1">
<!-- notice the value="tab1" above -->
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
<input type="file" name="myUploadName" />
<input type="submit" />
</form>
Then, the upload form for tab 2 could look as follows:
<form action="upload.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="<?php echo ini_get("session.upload_progress.name"); ?>" value="tab2">
<!-- notice the value="tab2" above -->
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
<input type="file" name="myUploadName" />
<input type="submit" />
</form>
Now that you have created two different upload progress sessions, you can get the progress data on the PHP side as follows:
$_SESSION['upload_progress_tab1'] // Progress data for tab 1
$_SESSION['upload_progress_tab2'] // Progress data for tab 2
This example could work for you:
http://www.johnboy.com/php-upload-progress-bar/
You need some client (JS) code and a bit of PHP