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 concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Improve this question
Here there's a tutorial about AJAX file upload :
https://phpacademy.org/course/javascript-ajax-file-upload-with-progress-indicator
"A JavaScript AJAX file uploader that handles multiple file upload and percentage progress indicator. Uses PHP to handle file uploading."
What's the purpose of doing all this javascript with FormData and XMLHttpRequest to send the files?
I'm sorry, I just don't get it.
It's PHP that sends the file. What's uploaded by AJAX ?
Patrick
One of the advantages of using AJAX in your life is that you send stuff to the server without making the browser loading a new page. With that AJAX file uploader, you send files to the server but you are always on the same page. With FormData you can do things like showing a progress bar of the upload.
What's the purpose of doing all this javascript with FormData and XMLHttpRequest to send the files?
So you can do it without leaving the page
It's PHP that sends the file.
No, PHP receives the file.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
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.
Closed 8 years ago.
Improve this question
Hi i wana make a request in my script to a other page and the request have some get Parameters they come back.
(I dont wana do this with ajax only php in one script)
this should be done without redirecting to other page. I wana make this in the background to validate the data they come back from the other page in one script
www.example.de -> request www.exampel2.de/?ex=1
then i will validate the example2 get parameter in example.de
Any solutions?
PHP's cURL functions will allow you to perform advanced HTTP requests. You can use file_get_contents to access REST APIs:
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
What is the problem this code:
$window_width= '<script>screen.availWidth</script>';
$window_height= '<script>screen.availHeight</script>';
any idea?
Nothing wrong in your code, but you can't get any values in PHP variable, because PHP is Server side scripting language.
You need JavaScript, not PHP.
var screenWidth = window.screen.width,
var screenHeight = window.screen.height;
You can then send it to the server via Ajax (with an XmlHttpRequest).
You seem to be misunderstanding the basic concepts of how PHP and HTML/JavaScript works together. PHP is a server-side language and JavaScript is a client-side language.
PHP generates the output first and then it's transferred to the client where it's being executed. You're trying to do it the other way around.
What you need to do is first, generate a page using PHP, have it sent to the client for client-side execution, and from there have JavaScript perform a call that sends the information back to PHP using a GET/POST request.
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
Here's the deal:
I have blog, where I can only use a javascript and free php server. I need to send form data to that php server (this I know how to do), and return some info back to the blog page. Is that even possible?
The only way I can think with out cross domain request is as below
1) make this form in your blog
<form action="FULL_URL_TO_YOUR_PHP_FILE">
/// your fields
</form>
2) in your php file save data received from form and serialize the data(that you want to send back to your blog) in url format like
if you want to pass name and surname YOUR_BLOG_URL?name=myName&surname=MySurname and make redirect from your php file to your blog
header('location:YOUR_BLOG_URL?name=myName&surname=MySurname');exit;
3) now on your blog make an onload event like if you have jquery than
$(document).ready(function(){
alert(window.location.href);
// do some spliting or regexp or anything else to get your data from url
})
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions must demonstrate a minimal understanding of the problem being solved. Tell us what you've tried to do, why it didn't work, and how it should work. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
This is something I need help on.
Im going to allow a user from my database to "share" a record which gets sent from the database into a solid html file.
So I'm looking at ways to create a html file from data in a database which is passed through php and stored in a location on the server. with no interaction from the user at all other than pressing 'share'. They would be sent the url to look at it upon success.
I'm looking for any functions or tuts on how to best make a html file from php. any help is appreciated. I think I may be looking into this too much, and the answer may be staring me in the face
As it got clear, you want static html files, created dynamically via PHP and written on the server.
The steps you need to follow are clear too:
You need the database and as you said you have it
You need to connect to it via PHP
Then do the respective queries
Fetch the data from them
Use it in the HTML
Open a file
Send the used data to it
Write the file with the relevant name
The querying should start after the button share is clicked (you can track this via isset() function)
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I want to post an array or set of variable in a URL and post that data to that URL.
i have a URL to post data
i have code igniter
i have to send data to that URL using code igniter function
So how should i send that data to that URL?
people say use curl PHP, i am a web developer using Linux but new to it, so kindly be easy.
Best Regards
cURL is an easy way to send/retrieve data from other URLs. Personally, I find it to be fairly easy to use too -- you can see a tutorial here. If you don't have cURL, there are other options.
If you need to forward the user to another URL using POST, then you're in a bit more of a bind. HTTP was not designed that way. You can create a page on your side which has a form filled out with all of the post variables and have a script tag with document.forms[0].submit().