Android Question Deleting a file off my website

Robert Valentino

Well-Known Member
Licensed User
I use the following to Download a file a text file:
B4X:
Dim Job           As HttpJob
Dim Job2         As HttpJob

Job.Initialize("", Me)
Job.Download(http://www.bowlingbrackets.com//BBs//did_5200e1634e441517.txt &"?dummy=" & DateTime.Now)

Wait For (Job) JobDone(Job As HttpJob)

If    Job.Success Then 
       ...
end if

Job.Release

But when I use the following to try and delete the text file
B4X:
Job2.Initialize("", Me)
Job2.Delete(http://www.bowlingbrackets.com//BBs//did_5200e1634e441517.txt)
                                       
Wait For (Job2) JobDone(Job2 As HttpJob)   
                                       
Job2.Release

I get the following Error
B4X:
ResponseError. Reason: Method Not Allowed, Response: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>405 Method Not Allowed</title>
</head><body>
<h1>Method Not Allowed</h1>
<p>The requested method DELETE is not allowed for the URL /BBs//did_5200e1634e441517.txt.</p>
</body></html>

I believe I need a password but am not sure how to add it to the command

Not to mention concerned about hard coding a password in my app

How should I do this.

BobVal

PS: Happy New Year to ALL
 

colboy

Member
Licensed User
Most servers are usually setup to not allow the deletion of files using HTTP. Can you not do it via FTP, if you have access to the server?
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
So are you saying if I change the HTTP to FTP it will let me delete the file?

I believe it will need a password and am not sure how to give it?


Found ftp.FileDelete in a search. Now just need to get it to work
 
Last edited:
Upvote 0
Top