FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
javascript-image-upload/process.php at master · chicuonght/javascript-image-upload · GitHub
chicuonght
/
javascript-image-upload
Public
forked from
joelvardy/javascript-image-upload
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
javascript-image-upload
/
process.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
23 lines (17 loc) · 438 Bytes
Breadcrumbs
javascript-image-upload
/
process.php
Copy path
File metadata and controls
23 lines (17 loc) · 438 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
// Generate filename
$
filename
=
md5
(
mt_rand
()).
'
.jpg
'
;
// Read RAW data
$
data
=
file_get_contents
(
'
php://input
'
);
// Read string as an image file
$
image
=
file_get_contents
(
'
data://
'
.
substr
(
$
data
,
5
));
// Save to disk
if
( !
file_put_contents
(
'
images/
'
.
$
filename
,
$
image
)) {
header
(
'
HTTP/1.1 503 Service Unavailable
'
);
exit
();
}
// Clean up memory
unset(
$
data
);
unset(
$
image
);
// Return file URL
echo
'
./images/
'
.
$
filename
;
Back
|
FazBrowse Home
|
New Git URL