Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

137
Visualizações
Not allowed to load local resource - while trying to get full path

It is a Blazor project

Below is the Index.razor:

//A file selector that returns only file name instead of full path
<InputFile id="flpicker" OnChange="@OnInputFileChange" multiple />
<p>@fileName</p> // displays file name that was picked (i.e.example1.json)

//below four line passes file name to JS
@{
var passFileName = @fileName;
}
<input type="hidden" id="PassingFileNameToJS" value=@passFileName>

@code{
  string fileName;
  //below function gets file name
  private async Task OnInputFileChange(InputFileChangeEventArgs e)
  {
    foreach (var File in e.GetMultipleFiles(e.FileCount))
    {           
        var Name = File.Name;
        fileName = Name;
    }
} 
}

Below is the index.js: Full path of file selected.

var filePath= "file:///C:/JsonFiles/" + document.getElementById("PassingFileNameToJS").value;

'document.getElementById("PassingFileNameToJS")' provides file name "example1.json". But in order to get full path, I hard to hardcode values.

When I use this above full filepath for opening file, throws error as "Not allowed to load local resource: file:///C:/JsonFiles/example1.json".

Is it possible to get full path without hardcoding values like above? Any help would be appreciated.

about 4 years ago · Santiago Gelvez
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda