Android Question Delete a file on a website with http

toro1950

Active Member
Licensed User
Hi, I need to remove a file on a website without using FTP.
I tried this, and it doesn't give me an error, but it doesn't remove the file.

B4X: Copy
Public Sub Delete
    Dim j As HttpJob
    j.Initialize("", Me)
    j.Delete("https://www.miosito.it/public/Subfolder/"& Filename)
    Wait For (j) JobDone(j As HttpJob)
     If j.Success Then
    Msgbox ("ok","")
    End If
j.Release
End Sub

I saw that it accepts j.Delete, so I think it can be done. If so,
can someone help me?
 
Hi, I need to remove a file on a website without using FTP.
I tried this, and it doesn't give me an error, but it doesn't remove the file.

B4X: Copy
Public Sub Delete
    Dim j As HttpJob
    j.Initialize("", Me)
    j.Delete("https://www.miosito.it/public/Subfolder/"& Filename)
    Wait For (j) JobDone(j As HttpJob)
     If j.Success Then
    Msgbox ("ok","")
    End If
j.Release
End Sub

I saw that it accepts j.Delete, so I think it can be done. If so,
can someone help me?
I think... and i am saying i think because i am not 100% sure... that Delete has to do with the end-rest API and if supports it...

For example POST, GET, Poststring, PUSH... all these will work if rest api (from server side) has the feature...

Somehow for Delete too...

For example you can't Delete Files from any web-server.... that will be totally bad for all sites.. don;t you think ?

 
Upvote 0
So if you have a custom b4j server project you must use it may be like this:

at server side jserver:
Code: Copy
Sub Handle(req As ServletRequest, resp As ServletResponse)
    If req.HttpMethod = "DELETE" Then
        Dim fileName As String = req.GetParameter("filename")
        ' Call your file deletion logic here
    End If
End Sub

But be careful... use passwords, use some "security logic"
 
Upvote 0
You can not delete files on a webserver without having an Apipoint doing the delete. It would be a really bad security-hole if you could do that.
 
Upvote 0
Thank you all for your interest, I will return to FTP, I will have to find a solution for a possible change of password of the website
 
Upvote 0
Back
Top