Click here to Skip to main content
15,867,308 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralMessage Closed Pin
16-Dec-21 11:25
cryptorobotics16-Dec-21 11:25 
AnswerRe: Recommended Apps to learn java for student? Pin
Richard MacCutchan11-Nov-21 21:04
mveRichard MacCutchan11-Nov-21 21:04 
AnswerRe: Recommended Apps to learn java for student? Pin
jhonaa28-Mar-22 0:10
jhonaa28-Mar-22 0:10 
QuestionUploading image using JQuery AJAX Pin
Alex Dunlop10-Nov-21 18:56
Alex Dunlop10-Nov-21 18:56 
AnswerRe: Uploading image using JQuery AJAX Pin
Richard Deeming10-Nov-21 21:44
mveRichard Deeming10-Nov-21 21:44 
GeneralRe: Uploading image using JQuery AJAX Pin
Alex Dunlop10-Nov-21 22:14
Alex Dunlop10-Nov-21 22:14 
GeneralRe: Uploading image using JQuery AJAX Pin
Richard Deeming10-Nov-21 22:17
mveRichard Deeming10-Nov-21 22:17 
AnswerRe: Uploading image using JQuery AJAX Pin
jkirkerx16-Nov-21 13:50
professionaljkirkerx16-Nov-21 13:50 
Regardless of whether your using jQuery which was obsoleted back in 2016 or so, or JavaScript, you need to read the file and convert the binary data to a base64 string, and then just HTTP POST that base64 string to the PHP API. The PHP API would convert the base64 string back to binary data, and just write the binary data as a image file. I found using base64 strings more reliable that sending binary data to the web server.

As far as cropping goes, that another story for the PHP world and PHP image processing that you would add to the API, in the form of coordinates.

On the PHP side, grabbing the HTTP POST payload would be, well I would of used this instead for PHP 7.4+.
$imagePayload = file_get_contents('php://input');
You don't need to try the payload, it's either there or not.

I forgot how to write jQuery, that was years ago for me. I just use plain vanilla JavaScript now.
If it ain't broke don't fix it
Discover my world at jkirkerx.com

GeneralRe: Uploading image using JQuery AJAX Pin
Richard Deeming17-Nov-21 0:46
mveRichard Deeming17-Nov-21 0:46 
GeneralRe: Uploading image using JQuery AJAX Pin
jkirkerx17-Nov-21 6:18
professionaljkirkerx17-Nov-21 6:18 
Questionhow do you paint objects with two different colors in the for repetition structure Pin
Member 1541326530-Oct-21 3:38
Member 1541326530-Oct-21 3:38 
AnswerRe: how do you paint objects with two different colors in the for repetition structure Pin
Richard MacCutchan30-Oct-21 4:25
mveRichard MacCutchan30-Oct-21 4:25 
GeneralRe: how do you paint objects with two different colors in the for repetition structure Pin
Member 1541326530-Oct-21 9:07
Member 1541326530-Oct-21 9:07 
AnswerRe: sytax error unexcepted token Pin
OriginalGriff5-Oct-21 21:20
mveOriginalGriff5-Oct-21 21:20 
GeneralRe: sytax error unexcepted token Pin
Richard Deeming5-Oct-21 21:44
mveRichard Deeming5-Oct-21 21:44 
GeneralRe: sytax error unexcepted token Pin
OriginalGriff5-Oct-21 21:52
mveOriginalGriff5-Oct-21 21:52 
Questiondata import via API Pin
Francesco Reboldi23-Sep-21 19:28
Francesco Reboldi23-Sep-21 19:28 
AnswerRe: data import via API Pin
Afzaal Ahmad Zeeshan23-Sep-21 23:47
professionalAfzaal Ahmad Zeeshan23-Sep-21 23:47 
GeneralRe: data import via API Pin
Afzaal Ahmad Zeeshan24-Sep-21 4:11
professionalAfzaal Ahmad Zeeshan24-Sep-21 4:11 
GeneralRe: data import via API Pin
Francesco Reboldi24-Sep-21 5:13
Francesco Reboldi24-Sep-21 5:13 
GeneralRe: data import via API Pin
Francesco Reboldi25-Sep-21 6:26
Francesco Reboldi25-Sep-21 6:26 
QuestionRegex not keeping the . or decimal with currency value with keydown event. Pin
jkirkerx23-Sep-21 9:06
professionaljkirkerx23-Sep-21 9:06 
AnswerRe: Regex not keeping the . or decimal with currency value with keydown event. Pin
Member 1532961323-Sep-21 9:32
Member 1532961323-Sep-21 9:32 
GeneralRe: Regex not keeping the . or decimal with currency value with keydown event. Pin
jkirkerx23-Sep-21 9:39
professionaljkirkerx23-Sep-21 9:39 
GeneralRe: Regex not keeping the . or decimal with currency value with keydown event. Pin
Member 1532961324-Sep-21 1:07
Member 1532961324-Sep-21 1:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.