User Tools

Site Tools


start:wiki:engines:godot4:faq:web:download

This is an old revision of the document!


How download file, Godot web / Как скачать файл под web в Godot

Скачиваем png картинку:

downloadPng.php
func save_png(img : Image, path : String, filename : String): 
    var err = img.save_png(path+"/"+filename+".png")
    # Тут требуется вставить проверки err на ошибки 
    Download_File(path+"/"+filename+".png",filename)

Коды ошибок для err

Скачиваем как обычный двоичный файл:

downloadFile.php
func download_file(path : String, filename : String):
    var f = File.new()
    f.open(path,File.READ)
    var buf = f.get_buffer(f.get_len())
    JavaScript.download_buffer(buf,filename+".png")
    f.close()

start/wiki/engines/godot4/faq/web/download.1716554077.txt.gz · Last modified: 2024/05/24 15:34 by rufus

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki