Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sfcode
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ayush
sfcode
Commits
b931fd13
Commit
b931fd13
authored
Dec 07, 2020
by
Adarsh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor
parent
35ffb92d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
34 deletions
+10
-34
src/app/file.service.ts
src/app/file.service.ts
+9
-2
src/app/file/file.component.html
src/app/file/file.component.html
+0
-31
src/app/file/file.component.ts
src/app/file/file.component.ts
+1
-1
No files found.
src/app/file.service.ts
View file @
b931fd13
...
@@ -9,7 +9,8 @@ import {HttpClient} from '@angular/common/http';
...
@@ -9,7 +9,8 @@ import {HttpClient} from '@angular/common/http';
})
})
export
class
FileService
{
export
class
FileService
{
baseApiUrl
=
'
http://localhost/sfcode/backend/filesave.php
'
;
saveUrl
=
'
http://localhost/sfcode/backend/filesave.php
'
;
uploadUrl
=
'
http://localhost/sfcode/backend/fileupload.php
'
;
constructor
(
private
http
:
HttpClient
)
{
constructor
(
private
http
:
HttpClient
)
{
}
}
...
@@ -34,7 +35,13 @@ export class FileService {
...
@@ -34,7 +35,13 @@ export class FileService {
}
}
upload
(
file
):
Observable
<
any
>
{
upload
(
file
):
Observable
<
any
>
{
return
this
.
http
.
post
(
this
.
baseApiUrl
,
file
);
return
this
.
http
.
post
(
this
.
saveUrl
,
file
);
}
upload2
(
file
):
Observable
<
any
>
{
const
formData
=
new
FormData
();
formData
.
append
(
"
file
"
,
file
,
file
.
name
);
return
this
.
http
.
post
(
this
.
uploadUrl
,
formData
)
}
}
}
}
src/app/file/file.component.html
View file @
b931fd13
...
@@ -16,37 +16,6 @@
...
@@ -16,37 +16,6 @@
</div>
</div>
<!--<div id="myModal" class="modal" [class.open]="uploadPopupActive">-->
<!-- <!– Modal content –>-->
<!-- <div class="modal-content">-->
<!-- <span (click)="onClick2()" class="close">×</span>-->
<!-- <div class="text-center">-->
<!-- <input class="form-control" type="file"-->
<!-- (change)="onChange($event)">-->
<!-- <button (click)="onUpload()"-->
<!-- class="btn btn-success">-->
<!-- Upload-->
<!-- </button>-->
<!-- </div>-->
<!-- <!– Shareable short link of uoloaded file –>-->
<!-- <div class="container text-center jumbotron"-->
<!-- *ngIf="shortLink">-->
<!-- <h2> Visit Here</h2>-->
<!-- <a href="{{shortLink}}">{{shortLink}}</a>-->
<!-- </div>-->
<!-- <!–Flag variable is used here–>-->
<!-- <div class="container" *ngIf="loading">-->
<!-- <h3>Loading ...</h3>-->
<!-- </div>-->
<!-- </div>-->
<!--</div>-->
<div
[class.open]=
"uploadPopupActive"
id=
"file-upload-cover"
></div>
<div
[class.open]=
"uploadPopupActive"
id=
"file-upload-cover"
></div>
...
...
src/app/file/file.component.ts
View file @
b931fd13
...
@@ -40,7 +40,7 @@ export class FileComponent implements OnInit {
...
@@ -40,7 +40,7 @@ export class FileComponent implements OnInit {
this
.
loading
=
true
;
this
.
loading
=
true
;
console
.
log
(
this
.
fileToUpload
);
console
.
log
(
this
.
fileToUpload
);
this
.
fileService
.
upload
(
this
.
fileToUpload
).
subscribe
(
this
.
fileService
.
upload
2
(
this
.
fileToUpload
).
subscribe
(
(
event
:
any
)
=>
{
(
event
:
any
)
=>
{
if
(
typeof
(
event
)
===
'
object
'
)
{
if
(
typeof
(
event
)
===
'
object
'
)
{
this
.
fileToUpload
=
null
;
this
.
fileToUpload
=
null
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment