TrattTratt
ASP.NET core, Access Table that is defined in another project
To clarify im using the same sql db for two projects, my web app project (where I wanna get the File from the table FIles) and my azure functions project (where I have the Files in the context and where I set the File)
19 replies
ASP.NET core, send more data with formData
might be something here? const formData = new FormData();
formData.append("file", e.target["file"].files[0]);
formData.append("TestValue", "contentvalue");
//here I would like to be adding a string that I can get from my fileUpload function
const res = await fetch("http://localhost:7036/api/Upload?containerName=products", {
method: "post",
body: formData,
})
47 replies
ASP.NET core, send more data with formData
public async Task<IActionResult> Run([HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequest req,[FromForm] MyCoolData data)
{
try
{
if(req.Form.Files["file"] is IFormFile file)
{
var containerName = !string.IsNullOrEmpty(req.Query["containerName"]) ? req.Query["containerName"].ToString() : "files";
var fileEntity = new FileEntity
{
FileName = _fileService.SetFileName(file),
ContentType = file.ContentType,
ContainerName = containerName
};
var testValueContent = data.TestValue;
47 replies