https://discord.cloudflare.com logo
Join Discord
Powered by
# r2
  • r

    Ryder Cragie

    05/14/2023, 5:54 PM
    This renders as html: https://cdn.rydercragie.com/test.html This renders as txt: https://cdn.rydercragie.com/assets/index.php
  • z

    zegevlier

    05/14/2023, 5:56 PM
    PHP requires a server to run the PHP code. R2 (same as any other S3 provider) doesn't run PHP code on there servers in order to execute the file
  • r

    Ryder Cragie

    05/14/2023, 5:56 PM
    Thanks
  • z

    zegevlier

    05/14/2023, 5:59 PM
    (Also note that the browser inferred what it was supposed to do with the file itself, if you want to control that yourself you can do that by setting the
    Content-Type
    header. See here for info on that:
  • r

    Ryder Cragie

    05/14/2023, 6:13 PM
    And that would have to be set up on every client machine that wants it to work?
  • r

    Ryder Cragie

    05/14/2023, 6:16 PM
    Or is it just one of these?

    https://cdn.discordapp.com/attachments/940663374377783388/1107370973746970816/IMG_3896.png▾

  • h

    HardAtWork

    05/14/2023, 6:18 PM
    No, you set the
    Content-Type
    when uploading
  • r

    Ryder Cragie

    05/14/2023, 6:18 PM
    What’s the easiest way to do that?
  • r

    Ryder Cragie

    05/14/2023, 6:18 PM
    This link is confusing me.
  • h

    HardAtWork

    05/14/2023, 6:21 PM
    Should work with
    rclone
    Copy code
    sh
    rclone move --http-headers '"Content-Type","text/html; charset=UTF-8"' someFile.txt r2:/someDirectory
  • r

    Ryder Cragie

    05/14/2023, 9:47 PM
    Is it possible to use R2 with a wildcard subdomain to have files from one bucket visible on all subdomains?
  • k

    Karew

    05/15/2023, 7:04 AM
    R2 doesn't seem to allow wildcards right now, but you can add multiple domains to the same bucket (like if you want 10 or something for some kind of distribution)
  • r

    Ryder Cragie

    05/15/2023, 7:04 AM
    Okay. Thanks.
  • s

    Sourabh.Sashank

    05/15/2023, 10:54 AM
    Hello, Can we upload mulitple files to R2 using worker api.
  • s

    Sourabh.Sashank

    05/15/2023, 11:00 AM
    I need to get the filename from the ReadableStream
  • s

    Sourabh.Sashank

    05/15/2023, 11:01 AM
    Multiple Files and Store with the Different Keys based on filename
  • s

    Sid | R2

    05/15/2023, 11:12 AM
    How you get the file name etc. will be specific to your implementation, but you should be able to
    .put
    multiple times to upload multiple files from the Workers API
  • e

    elithrar

    05/15/2023, 12:01 PM
    To add: you could use
    Promise.allSettled
    to fire them all off async, at once, and retry/catch any failures.
  • s

    Sourabh.Sashank

    05/15/2023, 12:18 PM
    We are Sending the data as FormData from client to worker. This formdata can have mulitple files, not able to loop through these files in the worker to .put multiple times, its coming as ReadableStream and not getting eaxct number of files inside worker api.
  • s

    Sid | R2

    05/15/2023, 12:26 PM
    If you don't mind buffering your files in memory (read: if they are small enough), you should be able to use Request#formData() to parse your request's body: https://developers.cloudflare.com/workers/runtime-apis/request/#instance-methods, which should let you iterate over all keys and get your filenames. The
    .formData()
    API doesn't work in a "streaming" fashion, so for larger files, you'll have to do this parsing yourself (It's also debatable if formData is the right choice for large files IMO)
  • s

    Sid | R2

    05/15/2023, 12:28 PM
    (When I say small enough, I mean small enough to fit in the Worker's memory, which is 128MB. I'd say a few megabytes would be the upper limit of what will work reliably)
  • l

    Lone Wolf

    05/15/2023, 6:16 PM
    Hi everyone quick question. Got a bit of weirdness using an rclone mount. when i try to upload it says permission denied if it needs to overwrite a file that's already there
  • l

    Lone Wolf

    05/15/2023, 6:17 PM
    oh and another question (buy one get one free). So the storage went live this morning with about 1.6 million objects and it seems to be steadily getting faster to access
  • l

    Lone Wolf

    05/15/2023, 6:17 PM
    am I dreaming or is something going on
  • l

    Lone Wolf

    05/15/2023, 6:17 PM
    ?
  • l

    Lone Wolf

    05/15/2023, 7:54 PM
    in fact it's hilariously fast
  • s

    Sid | R2

    05/15/2023, 7:55 PM
    Does your token have readonly access?
  • l

    Lone Wolf

    05/15/2023, 7:55 PM
    no
  • l

    Lone Wolf

    05/15/2023, 7:55 PM
    its read & write
  • l

    Lone Wolf

    05/15/2023, 7:55 PM
    i have created a custom domain on it but thats just for certain parts of it
1...102910301031...1050Latest